@remnic/core 1.1.31 → 9.3.516
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/abstraction-nodes.js +2 -2
- package/dist/access-cli.d.ts +1 -1
- package/dist/access-cli.js +158 -121
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +9 -5
- package/dist/access-http.js +51 -51
- package/dist/access-idempotency.d.ts +2 -0
- package/dist/access-idempotency.js +1 -1
- package/dist/access-mcp.d.ts +16 -9
- package/dist/access-mcp.js +44 -44
- package/dist/access-schema.d.ts +45 -13
- package/dist/access-schema.js +8 -8
- package/dist/{access-service-CkZyb35d.d.ts → access-service-CZfksQuS.d.ts} +11 -130
- package/dist/access-service.d.ts +7 -4
- package/dist/access-service.js +40 -40
- package/dist/action-confidence.d.ts +1 -0
- package/dist/active-memory-bridge.d.ts +1 -0
- package/dist/active-memory-bridge.js +3 -2
- package/dist/active-recall.d.ts +1 -0
- package/dist/active-recall.js +14 -9
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/claude-code.d.ts +6 -2
- package/dist/adapters/claude-code.js +2 -2
- package/dist/adapters/codex.d.ts +5 -1
- package/dist/adapters/codex.js +2 -2
- package/dist/adapters/hermes.js +2 -2
- package/dist/adapters/index.js +6 -6
- package/dist/adapters/registry.js +6 -6
- package/dist/adapters/replit.d.ts +4 -2
- package/dist/adapters/replit.js +2 -2
- package/dist/adapters/types.d.ts +4 -0
- package/dist/adapters/types.js +1 -1
- package/dist/behavior-learner.d.ts +1 -0
- package/dist/behavior-signals.d.ts +1 -0
- package/dist/behavior-signals.js +1 -1
- package/dist/bootstrap.d.ts +5 -3
- package/dist/bootstrap.js +2 -2
- package/dist/boxes.d.ts +1 -0
- package/dist/boxes.js +1 -1
- package/dist/briefing.d.ts +1 -0
- package/dist/briefing.js +9 -9
- package/dist/buffer-surprise-report.d.ts +1 -0
- package/dist/buffer.d.ts +1 -0
- package/dist/buffer.js +2 -2
- package/dist/bulk-import/index.d.ts +28 -0
- package/dist/bulk-import/index.js +31 -0
- package/dist/calibration.d.ts +2 -0
- package/dist/calibration.js +50 -17
- package/dist/calibration.js.map +1 -1
- package/dist/{capsule-crypto-5CYAGVC5.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/{capsule-merge-4MGKE7C5.js → capsule-merge-T2JRE46P.js} +3 -3
- package/dist/causal-behavior.d.ts +1 -0
- package/dist/causal-behavior.js +4 -4
- package/dist/causal-chain.js +4 -4
- package/dist/causal-consolidation.d.ts +16 -1
- package/dist/causal-consolidation.js +115 -32
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +14 -6
- package/dist/causal-retrieval.js.map +1 -1
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +2 -2
- package/dist/{chunk-SAZS2QZB.js → chunk-23UORJ4S.js} +3 -3
- package/dist/{chunk-76FLAAUC.js → chunk-2AN2L4NL.js} +17 -6
- package/dist/chunk-2AN2L4NL.js.map +1 -0
- package/dist/{chunk-W4L6CZKA.js → chunk-2DL3OFLD.js} +15 -10
- package/dist/chunk-2DL3OFLD.js.map +1 -0
- package/dist/{chunk-NJ3MJQZX.js → chunk-2I5JGH3M.js} +2 -2
- package/dist/{chunk-NJ3MJQZX.js.map → chunk-2I5JGH3M.js.map} +1 -1
- package/dist/{chunk-7OZ53EXP.js → chunk-2NLLXCJG.js} +21 -10
- package/dist/chunk-2NLLXCJG.js.map +1 -0
- package/dist/{chunk-PK7H5L6Y.js → chunk-2NM43EWN.js} +2 -2
- package/dist/{chunk-PYXS46O7.js → chunk-3BP57I6J.js} +2 -2
- package/dist/{chunk-FBYESMQ2.js → chunk-3C5RPJAX.js} +2 -2
- package/dist/{chunk-FKFMOY3N.js → chunk-42NQ7AVG.js} +3 -4
- package/dist/{chunk-FKFMOY3N.js.map → chunk-42NQ7AVG.js.map} +1 -1
- package/dist/chunk-4426WSWL.js +73 -0
- package/dist/chunk-4426WSWL.js.map +1 -0
- package/dist/{chunk-LIRZNNUP.js → chunk-44442YCH.js} +5 -2
- package/dist/chunk-44442YCH.js.map +1 -0
- package/dist/{chunk-H3ME6L6D.js → chunk-46GJIW5M.js} +23 -20
- package/dist/chunk-46GJIW5M.js.map +1 -0
- package/dist/{chunk-QDZ2RLEC.js → chunk-472U7RDF.js} +3 -3
- package/dist/chunk-472U7RDF.js.map +1 -0
- package/dist/{chunk-NN2DKE4T.js → chunk-4H5ZJHEN.js} +16 -3
- package/dist/{chunk-NN2DKE4T.js.map → chunk-4H5ZJHEN.js.map} +1 -1
- package/dist/{chunk-56K5QLHX.js → chunk-4HP7HIE3.js} +56 -13
- package/dist/chunk-4HP7HIE3.js.map +1 -0
- package/dist/{chunk-RK2Y4XOM.js → chunk-4JRRISLU.js} +9 -6
- package/dist/chunk-4JRRISLU.js.map +1 -0
- package/dist/{chunk-XKLD5OK4.js → chunk-4RR6ROTB.js} +10 -11
- package/dist/chunk-4RR6ROTB.js.map +1 -0
- package/dist/{chunk-YROHKYBY.js → chunk-5UHVGNZD.js} +22 -6
- package/dist/chunk-5UHVGNZD.js.map +1 -0
- package/dist/{chunk-ZAVUCJ4H.js → chunk-5V456VRV.js} +154 -69
- package/dist/chunk-5V456VRV.js.map +1 -0
- package/dist/{chunk-77H5NU3M.js → chunk-6BR7L222.js} +82 -18
- package/dist/chunk-6BR7L222.js.map +1 -0
- package/dist/{chunk-4KGVTPGD.js → chunk-6F6BXB7A.js} +9 -8
- package/dist/chunk-6F6BXB7A.js.map +1 -0
- package/dist/{chunk-NMZY542O.js → chunk-6URPAY2D.js} +41 -17
- package/dist/chunk-6URPAY2D.js.map +1 -0
- package/dist/{chunk-N53K2EXC.js → chunk-6VF75M3X.js} +2 -2
- package/dist/{chunk-XSZEP4SF.js → chunk-6XSPNR6L.js} +6 -5
- package/dist/chunk-6XSPNR6L.js.map +1 -0
- package/dist/{chunk-6H2TESSP.js → chunk-765K3SAT.js} +3 -3
- package/dist/{chunk-EDTHC6UD.js → chunk-77NAFXUD.js} +2 -2
- package/dist/{chunk-S7KDBTWT.js → chunk-7F7Z6MOS.js} +29 -14
- package/dist/chunk-7F7Z6MOS.js.map +1 -0
- package/dist/{chunk-MZH6EHNR.js → chunk-7H6CFEBJ.js} +41 -14
- package/dist/chunk-7H6CFEBJ.js.map +1 -0
- package/dist/{chunk-MGKYQQYF.js → chunk-7Q3RCKAQ.js} +2 -2
- package/dist/chunk-7RXCMVFQ.js +27 -0
- package/dist/chunk-7RXCMVFQ.js.map +1 -0
- package/dist/{chunk-DGXUHMOV.js → chunk-A2IYSXDQ.js} +25 -6
- package/dist/chunk-A2IYSXDQ.js.map +1 -0
- package/dist/{chunk-EABGC2TL.js → chunk-A2Z6UCWT.js} +26 -4
- package/dist/chunk-A2Z6UCWT.js.map +1 -0
- package/dist/{chunk-5375UYTQ.js → chunk-A6D7A2FW.js} +4 -4
- package/dist/chunk-A6D7A2FW.js.map +1 -0
- package/dist/{chunk-FAAFWE4G.js → chunk-ALEPI75L.js} +24 -6
- package/dist/chunk-ALEPI75L.js.map +1 -0
- package/dist/{chunk-3SLRNYNG.js → chunk-AUDJPF4N.js} +15 -4
- package/dist/chunk-AUDJPF4N.js.map +1 -0
- package/dist/chunk-B5XMS73R.js +145 -0
- package/dist/chunk-B5XMS73R.js.map +1 -0
- package/dist/{chunk-HXXBL2KD.js → chunk-BECQDWBA.js} +44 -4
- package/dist/chunk-BECQDWBA.js.map +1 -0
- package/dist/{chunk-7SEAZFFB.js → chunk-BEUDU7Y4.js} +24 -4
- package/dist/chunk-BEUDU7Y4.js.map +1 -0
- package/dist/chunk-CHBI22MI.js +159 -0
- package/dist/chunk-CHBI22MI.js.map +1 -0
- package/dist/{chunk-GDFS42HT.js → chunk-CHCA44C3.js} +15 -8
- package/dist/chunk-CHCA44C3.js.map +1 -0
- package/dist/chunk-CINZGPSJ.js +22 -0
- package/dist/chunk-CINZGPSJ.js.map +1 -0
- package/dist/chunk-CMTINOFS.js +36 -0
- package/dist/chunk-CMTINOFS.js.map +1 -0
- package/dist/{chunk-34DQE4KF.js → chunk-CO7ZO4TU.js} +2 -2
- package/dist/{chunk-PFV5C235.js → chunk-CPPS65WS.js} +2 -1
- package/dist/{chunk-PFV5C235.js.map → chunk-CPPS65WS.js.map} +1 -1
- package/dist/{chunk-DINWEURR.js → chunk-CSKLPDN6.js} +20 -6
- package/dist/chunk-CSKLPDN6.js.map +1 -0
- package/dist/chunk-CWWMTTQE.js +566 -0
- package/dist/chunk-CWWMTTQE.js.map +1 -0
- package/dist/{chunk-IQT3XTKW.js → chunk-D24OXEPB.js} +13 -7
- package/dist/chunk-D24OXEPB.js.map +1 -0
- package/dist/{chunk-WIICJPET.js → chunk-DEUNUKTD.js} +6 -4
- package/dist/{chunk-WIICJPET.js.map → chunk-DEUNUKTD.js.map} +1 -1
- package/dist/{chunk-ZYVPLJ4T.js → chunk-DHGSZ3UD.js} +9 -7
- package/dist/chunk-DHGSZ3UD.js.map +1 -0
- package/dist/{chunk-JR4ZC3G4.js → chunk-DLJ4IR6M.js} +91 -41
- package/dist/chunk-DLJ4IR6M.js.map +1 -0
- package/dist/{chunk-U4SCL7B7.js → chunk-DRD2Q7HQ.js} +82 -18
- package/dist/chunk-DRD2Q7HQ.js.map +1 -0
- package/dist/{chunk-2IWUMAES.js → chunk-E62SBGQ3.js} +28 -13
- package/dist/chunk-E62SBGQ3.js.map +1 -0
- package/dist/{chunk-C5BCH4ZS.js → chunk-EAZGEEG2.js} +21 -3
- package/dist/chunk-EAZGEEG2.js.map +1 -0
- package/dist/{chunk-TPB3I2AC.js → chunk-ECZU5BJH.js} +31 -10
- package/dist/chunk-ECZU5BJH.js.map +1 -0
- package/dist/chunk-EDQVAMQI.js +308 -0
- package/dist/chunk-EDQVAMQI.js.map +1 -0
- package/dist/{chunk-RRF5UOBJ.js → chunk-EI6V5UXY.js} +22 -15
- package/dist/chunk-EI6V5UXY.js.map +1 -0
- package/dist/{chunk-ZKSK55RC.js → chunk-ETUPBUHB.js} +2 -2
- package/dist/{chunk-25MQ7IHJ.js → chunk-EUML3N6B.js} +17 -6
- package/dist/chunk-EUML3N6B.js.map +1 -0
- package/dist/{chunk-5RGLBDQF.js → chunk-EVZFIAPG.js} +12 -12
- package/dist/chunk-EVZFIAPG.js.map +1 -0
- package/dist/{chunk-QRNI5JBH.js → chunk-EYIEWJNI.js} +2 -2
- package/dist/{chunk-TPU5L5EY.js → chunk-FCOQXV3T.js} +272 -411
- package/dist/chunk-FCOQXV3T.js.map +1 -0
- package/dist/{chunk-TMQLARTH.js → chunk-FK556DDH.js} +34 -15
- package/dist/chunk-FK556DDH.js.map +1 -0
- package/dist/{chunk-43PJZYGL.js → chunk-FPGE5NVO.js} +45 -10
- package/dist/chunk-FPGE5NVO.js.map +1 -0
- package/dist/{chunk-3VAL7ZL2.js → chunk-FUC4LZMD.js} +60 -25
- package/dist/chunk-FUC4LZMD.js.map +1 -0
- package/dist/{chunk-C6QPK5GG.js → chunk-FZZ2QTJI.js} +2 -2
- package/dist/{chunk-D46YSIYX.js → chunk-G3Z3QEF5.js} +19 -11
- package/dist/{chunk-D46YSIYX.js.map → chunk-G3Z3QEF5.js.map} +1 -1
- package/dist/{chunk-3JXBXXM2.js → chunk-G4IAEX6D.js} +2 -2
- package/dist/{chunk-MSWG7JI6.js → chunk-G56P5RLD.js} +8 -2
- package/dist/chunk-G56P5RLD.js.map +1 -0
- package/dist/{chunk-AGZQD76C.js → chunk-GCGJW34D.js} +48 -2
- package/dist/chunk-GCGJW34D.js.map +1 -0
- package/dist/chunk-H2NCNXMS.js +159 -0
- package/dist/chunk-H2NCNXMS.js.map +1 -0
- package/dist/{chunk-XYIK4LF6.js → chunk-H3FZVNRN.js} +8 -2
- package/dist/chunk-H3FZVNRN.js.map +1 -0
- package/dist/{chunk-YU5KIWYQ.js → chunk-HC6EKOID.js} +94 -43
- package/dist/chunk-HC6EKOID.js.map +1 -0
- package/dist/{chunk-TK4UEOSK.js → chunk-HDDRVXX4.js} +8 -8
- package/dist/chunk-HDDRVXX4.js.map +1 -0
- package/dist/{chunk-LLQ2LLWF.js → chunk-HENLZHIT.js} +15 -5
- package/dist/chunk-HENLZHIT.js.map +1 -0
- package/dist/{chunk-N2D6GXBM.js → chunk-HINSGUA7.js} +28 -20
- package/dist/chunk-HINSGUA7.js.map +1 -0
- package/dist/{chunk-APO3DCMU.js → chunk-HLAVGJ62.js} +30 -8
- package/dist/chunk-HLAVGJ62.js.map +1 -0
- package/dist/{chunk-TPMQ3G6Z.js → chunk-HOJZMQ4J.js} +2 -2
- package/dist/chunk-HOJZMQ4J.js.map +1 -0
- package/dist/{chunk-LUDTDZLK.js → chunk-HPWVAEET.js} +33 -7
- package/dist/chunk-HPWVAEET.js.map +1 -0
- package/dist/{chunk-NZL6GGQE.js → chunk-HQ6NIBL6.js} +92 -30
- package/dist/chunk-HQ6NIBL6.js.map +1 -0
- package/dist/{chunk-UWVJF25J.js → chunk-HWVTS5NO.js} +20 -6
- package/dist/chunk-HWVTS5NO.js.map +1 -0
- package/dist/{chunk-2WWLHTZY.js → chunk-IC4GELZE.js} +2 -2
- package/dist/{chunk-QA2ZAPBU.js → chunk-IPLYGWQF.js} +28 -20
- package/dist/chunk-IPLYGWQF.js.map +1 -0
- package/dist/{chunk-A6KTB5R6.js → chunk-IQ3OI2RR.js} +3 -3
- package/dist/chunk-IQ3OI2RR.js.map +1 -0
- package/dist/{chunk-6LVVDPJ4.js → chunk-J64TK33U.js} +3 -4
- package/dist/chunk-J64TK33U.js.map +1 -0
- package/dist/{chunk-6FC5EGNV.js → chunk-JBPKEARU.js} +15 -5
- package/dist/{chunk-6FC5EGNV.js.map → chunk-JBPKEARU.js.map} +1 -1
- package/dist/{chunk-RHY3HH7P.js → chunk-JFEKNTX7.js} +125 -33
- package/dist/chunk-JFEKNTX7.js.map +1 -0
- package/dist/{chunk-TZOLIGIG.js → chunk-JJEJJ7RK.js} +4 -2
- package/dist/chunk-JJEJJ7RK.js.map +1 -0
- package/dist/{chunk-PCUKNJAZ.js → chunk-JKV57BTN.js} +2 -2
- package/dist/{chunk-EJI5XIBB.js → chunk-JLNBQWZ2.js} +55 -7
- package/dist/chunk-JLNBQWZ2.js.map +1 -0
- package/dist/{chunk-PIRJPV5T.js → chunk-JNANKJLN.js} +2 -2
- package/dist/chunk-JNANKJLN.js.map +1 -0
- package/dist/{chunk-XIG5PDM7.js → chunk-JUC24CTX.js} +8 -12
- package/dist/chunk-JUC24CTX.js.map +1 -0
- package/dist/{chunk-OIGNEXKZ.js → chunk-K5O2QY6T.js} +5 -1
- package/dist/{chunk-OIGNEXKZ.js.map → chunk-K5O2QY6T.js.map} +1 -1
- package/dist/{chunk-ZTFCYYEZ.js → chunk-KCYE2MZM.js} +3 -3
- package/dist/chunk-KCYE2MZM.js.map +1 -0
- package/dist/{chunk-JWPLJLDU.js → chunk-KD3QD3A5.js} +2 -2
- package/dist/{chunk-JWPLJLDU.js.map → chunk-KD3QD3A5.js.map} +1 -1
- package/dist/{chunk-YRMVARQP.js → chunk-KFY3SGN7.js} +49 -2
- package/dist/chunk-KFY3SGN7.js.map +1 -0
- package/dist/{chunk-CYFQJMUV.js → chunk-KIB7SDIJ.js} +15 -10
- package/dist/chunk-KIB7SDIJ.js.map +1 -0
- package/dist/{chunk-3KW65B36.js → chunk-KILOTVIF.js} +95 -48
- package/dist/chunk-KILOTVIF.js.map +1 -0
- package/dist/{chunk-MXFBBHJU.js → chunk-KJMYHC7K.js} +10 -5
- package/dist/chunk-KJMYHC7K.js.map +1 -0
- package/dist/{chunk-W3LR522O.js → chunk-KM2A35EO.js} +36 -34
- package/dist/chunk-KM2A35EO.js.map +1 -0
- package/dist/{chunk-575RMLWN.js → chunk-KXULCVOC.js} +30 -24
- package/dist/chunk-KXULCVOC.js.map +1 -0
- package/dist/{chunk-WELDCG6C.js → chunk-L227SKTB.js} +109 -36
- package/dist/chunk-L227SKTB.js.map +1 -0
- package/dist/{chunk-BVF3AGJP.js → chunk-LJBOVCQG.js} +26 -11
- package/dist/chunk-LJBOVCQG.js.map +1 -0
- package/dist/{chunk-2KI4QFHU.js → chunk-LMDRGRJ2.js} +2 -2
- package/dist/{chunk-MY6TPVXW.js → chunk-LMPHTYJC.js} +2 -2
- package/dist/{chunk-EHRTFRWW.js → chunk-LQHDIS7L.js} +10 -5
- package/dist/chunk-LQHDIS7L.js.map +1 -0
- package/dist/chunk-LUDUFZTV.js +170 -0
- package/dist/chunk-LUDUFZTV.js.map +1 -0
- package/dist/{chunk-5HRY2WRF.js → chunk-LZ3VEOU5.js} +2 -2
- package/dist/{chunk-Q7P4WJDP.js → chunk-M5T4Q2ZU.js} +1 -1
- package/dist/chunk-M5T4Q2ZU.js.map +1 -0
- package/dist/{chunk-ICRIXAP2.js → chunk-MC4FJXPA.js} +16 -6
- package/dist/chunk-MC4FJXPA.js.map +1 -0
- package/dist/{chunk-WPGJYVUH.js → chunk-MGVIEM2O.js} +23 -6
- package/dist/chunk-MGVIEM2O.js.map +1 -0
- package/dist/{chunk-NGAVDO7E.js → chunk-OADWQ5CR.js} +2 -2
- package/dist/{chunk-2NMMFZ5T.js → chunk-OD4FM2U7.js} +6 -3
- package/dist/chunk-OD4FM2U7.js.map +1 -0
- package/dist/{chunk-OZHRDTDX.js → chunk-OKTXM5H4.js} +11 -1
- package/dist/chunk-OKTXM5H4.js.map +1 -0
- package/dist/{chunk-RXDLTSWT.js → chunk-ONPLNAPX.js} +16 -7
- package/dist/chunk-ONPLNAPX.js.map +1 -0
- package/dist/{chunk-FJ43PRLT.js → chunk-ORFGK3XI.js} +20 -14
- package/dist/chunk-ORFGK3XI.js.map +1 -0
- package/dist/{chunk-DOM4GKSW.js → chunk-OZKVVUJB.js} +3 -3
- package/dist/{chunk-3TNBOMQT.js → chunk-PCI747N2.js} +13 -13
- package/dist/{chunk-3TNBOMQT.js.map → chunk-PCI747N2.js.map} +1 -1
- package/dist/{chunk-MT4HVDUZ.js → chunk-PM3QHTFT.js} +3 -3
- package/dist/{chunk-4DWOBS2A.js → chunk-PRQJ5ESM.js} +27 -2
- package/dist/{chunk-4DWOBS2A.js.map → chunk-PRQJ5ESM.js.map} +1 -1
- package/dist/chunk-PU44GBL4.js +52 -0
- package/dist/chunk-PU44GBL4.js.map +1 -0
- package/dist/{chunk-MJFNCJXV.js → chunk-Q4CAQGKQ.js} +47 -9
- package/dist/chunk-Q4CAQGKQ.js.map +1 -0
- package/dist/{chunk-U3WSW6PZ.js → chunk-QMYXNM4P.js} +90 -35
- package/dist/chunk-QMYXNM4P.js.map +1 -0
- package/dist/{chunk-XVVIG67A.js → chunk-QVJ4NWL2.js} +62 -18
- package/dist/chunk-QVJ4NWL2.js.map +1 -0
- package/dist/{chunk-NBNN5GOB.js → chunk-QY7YA7OL.js} +11 -2
- package/dist/chunk-QY7YA7OL.js.map +1 -0
- package/dist/{chunk-ZK7I7JYV.js → chunk-R3PS27B4.js} +7 -7
- package/dist/{chunk-2PRLKQAH.js → chunk-RLV3PQGH.js} +35 -19
- package/dist/chunk-RLV3PQGH.js.map +1 -0
- package/dist/{chunk-WW3QQF4H.js → chunk-ROZJACKP.js} +16 -1
- package/dist/chunk-ROZJACKP.js.map +1 -0
- package/dist/{chunk-7MNMYOFP.js → chunk-RSUYKGGZ.js} +3 -4
- package/dist/chunk-RSUYKGGZ.js.map +1 -0
- package/dist/{chunk-LT3NLYSI.js → chunk-RUZOJKNF.js} +10 -7
- package/dist/chunk-RUZOJKNF.js.map +1 -0
- package/dist/{chunk-326G7DJK.js → chunk-RW5DGAGO.js} +67 -13
- package/dist/chunk-RW5DGAGO.js.map +1 -0
- package/dist/{chunk-KOSORCJG.js → chunk-S53PKKWK.js} +63 -24
- package/dist/chunk-S53PKKWK.js.map +1 -0
- package/dist/{chunk-65PG43EQ.js → chunk-S7WU3Y3D.js} +21 -4
- package/dist/chunk-S7WU3Y3D.js.map +1 -0
- package/dist/{chunk-SKE7JYKA.js → chunk-SFXKHM7P.js} +2 -2
- package/dist/{chunk-HMDCOMYU.js → chunk-SKGV326D.js} +3 -3
- package/dist/{chunk-I5GLV3VE.js → chunk-SML26KED.js} +33 -26
- package/dist/{chunk-I5GLV3VE.js.map → chunk-SML26KED.js.map} +1 -1
- package/dist/chunk-T2PO5MUF.js +62 -0
- package/dist/chunk-T2PO5MUF.js.map +1 -0
- package/dist/{chunk-C7VW7C3F.js → chunk-TDKQGLJW.js} +3 -3
- package/dist/chunk-TDKQGLJW.js.map +1 -0
- package/dist/{chunk-3QKK7QOS.js → chunk-TERNBNJB.js} +3 -3
- package/dist/chunk-TERNBNJB.js.map +1 -0
- package/dist/{chunk-MXC3AP5I.js → chunk-TGQ2NTWH.js} +12 -7
- package/dist/chunk-TGQ2NTWH.js.map +1 -0
- package/dist/{chunk-3Y4P7RXM.js → chunk-TMSXWOBZ.js} +3 -4
- package/dist/chunk-TMSXWOBZ.js.map +1 -0
- package/dist/{chunk-3ZLVGM76.js → chunk-TTGZV5R3.js} +106 -44
- package/dist/chunk-TTGZV5R3.js.map +1 -0
- package/dist/{chunk-5UM2VJ6D.js → chunk-UEY3VB6W.js} +2 -2
- package/dist/{chunk-I6K5FBRQ.js → chunk-UI3NYK34.js} +4 -1
- package/dist/{chunk-I6K5FBRQ.js.map → chunk-UI3NYK34.js.map} +1 -1
- package/dist/{chunk-VBJ7V5SK.js → chunk-UIPDNLXA.js} +21 -8
- package/dist/chunk-UIPDNLXA.js.map +1 -0
- package/dist/{chunk-GIF42EW3.js → chunk-UP6MOYCB.js} +3 -3
- package/dist/{chunk-K4FLSOR5.js → chunk-USYGGIJZ.js} +44 -15
- package/dist/chunk-USYGGIJZ.js.map +1 -0
- package/dist/{chunk-FIT6DMX6.js → chunk-UWY7GIVS.js} +152 -54
- package/dist/chunk-UWY7GIVS.js.map +1 -0
- package/dist/{chunk-MRILGULB.js → chunk-V2RCP53Q.js} +2 -2
- package/dist/{chunk-XKECPATV.js → chunk-VFUEZZBS.js} +113 -4
- package/dist/chunk-VFUEZZBS.js.map +1 -0
- package/dist/{chunk-FSFEQI74.js → chunk-W7L6HXUC.js} +2 -2
- package/dist/{chunk-3IQ2TR4N.js → chunk-WLEB7WCG.js} +2 -2
- package/dist/{chunk-GL6I6MEQ.js → chunk-WSGF57U2.js} +3 -3
- package/dist/{chunk-KNKUID7G.js → chunk-X7Y7WX73.js} +72 -6
- package/dist/chunk-X7Y7WX73.js.map +1 -0
- package/dist/{chunk-5NPGSAVB.js → chunk-XEKAG3FM.js} +23 -5
- package/dist/chunk-XEKAG3FM.js.map +1 -0
- package/dist/{chunk-3APJ5EVB.js → chunk-XKIQZXUB.js} +41 -26
- package/dist/chunk-XKIQZXUB.js.map +1 -0
- package/dist/chunk-XKXKSQU7.js +92 -0
- package/dist/chunk-XKXKSQU7.js.map +1 -0
- package/dist/{chunk-JA3AK3PT.js → chunk-XNLXAWHX.js} +4 -4
- package/dist/{chunk-CULXMQJH.js → chunk-XPXEJRUB.js} +3 -3
- package/dist/chunk-XPXEJRUB.js.map +1 -0
- package/dist/{chunk-PZIAX57I.js → chunk-XR6DNK4U.js} +7 -4
- package/dist/chunk-XR6DNK4U.js.map +1 -0
- package/dist/{chunk-47VWKCAF.js → chunk-XSQ4SGM5.js} +33 -4
- package/dist/chunk-XSQ4SGM5.js.map +1 -0
- package/dist/{chunk-66DHUKLO.js → chunk-XSWKORGM.js} +16 -14
- package/dist/chunk-XSWKORGM.js.map +1 -0
- package/dist/{chunk-QR3C7BKQ.js → chunk-XZ4WBBB5.js} +7 -8
- package/dist/chunk-XZ4WBBB5.js.map +1 -0
- package/dist/{chunk-WNARATI3.js → chunk-Y2SXZ5KZ.js} +59 -11
- package/dist/chunk-Y2SXZ5KZ.js.map +1 -0
- package/dist/{chunk-QLLBRHAT.js → chunk-YDMVYYD2.js} +229 -264
- package/dist/chunk-YDMVYYD2.js.map +1 -0
- package/dist/{chunk-SIC6U3GZ.js → chunk-YHV3KRKS.js} +3 -3
- package/dist/{chunk-ZPKBYX2F.js → chunk-YNDLCWXS.js} +85 -9
- package/dist/chunk-YNDLCWXS.js.map +1 -0
- package/dist/{chunk-W6AQJ2PY.js → chunk-YNXOKMJP.js} +35 -16
- package/dist/chunk-YNXOKMJP.js.map +1 -0
- package/dist/{chunk-VLXA6PI2.js → chunk-YQMZ7IH2.js} +4 -4
- package/dist/{chunk-TMM4S4IJ.js → chunk-YR6GIWWY.js} +58 -8
- package/dist/chunk-YR6GIWWY.js.map +1 -0
- package/dist/{chunk-DK5LDEQM.js → chunk-YR7XMOWK.js} +39 -23
- package/dist/chunk-YR7XMOWK.js.map +1 -0
- package/dist/{chunk-U7EJOMFC.js → chunk-ZEY4KYRQ.js} +41 -14
- package/dist/chunk-ZEY4KYRQ.js.map +1 -0
- package/dist/chunk-ZFXCQPNO.js +27 -0
- package/dist/chunk-ZFXCQPNO.js.map +1 -0
- package/dist/citations.js +1 -1
- package/dist/{cli-kuh9PwZ5.d.ts → cli-CPe_2KB1.d.ts} +8 -31
- package/dist/cli.d.ts +10 -6
- package/dist/cli.js +124 -119
- package/dist/commitment-ledger.js +2 -2
- package/dist/compat/checks.js +1 -2
- package/dist/compounding/engine.d.ts +3 -2
- package/dist/compounding/engine.js +11 -11
- package/dist/compounding/preference-consolidator.d.ts +1 -0
- package/dist/compounding/preference-consolidator.js +8 -8
- package/dist/compounding/preference-consolidator.js.map +1 -1
- package/dist/compression-optimizer.d.ts +1 -0
- package/dist/compression-optimizer.js +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +3 -2
- package/dist/connectors/codex-materialize-runner.d.ts +1 -0
- package/dist/connectors/codex-materialize-runner.js +12 -11
- package/dist/connectors/codex-materialize.d.ts +1 -0
- package/dist/connectors/codex-materialize.js +3 -2
- package/dist/connectors/index.d.ts +1 -0
- package/dist/connectors/index.js +14 -14
- package/dist/{connectors-cli-CwbyjGR7.d.ts → connectors-cli-DbTPNj2H.d.ts} +7 -1
- package/dist/connectors-cli.d.ts +1 -1
- package/dist/connectors-cli.js +3 -1
- package/dist/consolidation-provenance-check.d.ts +1 -0
- package/dist/consolidation-provenance-check.js +2 -2
- package/dist/consolidation-undo.d.ts +1 -0
- package/dist/consolidation-undo.js +1 -1
- package/dist/contradiction/index.d.ts +3 -1
- package/dist/contradiction/index.js +3 -3
- package/dist/{contradiction-review-ATP4S6IC.js → contradiction-review-6V2LXXK6.js} +2 -2
- package/dist/{contradiction-scan-5A4IDZV5.js → contradiction-scan-GIRVC4C7.js} +3 -3
- package/dist/conversation-index/backend.d.ts +3 -1
- package/dist/conversation-index/backend.js +3 -3
- package/dist/conversation-index/chunker.d.ts +1 -0
- package/dist/conversation-index/cleanup.js +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +2 -1
- package/dist/conversation-index/faiss-adapter.js +1 -1
- package/dist/conversation-index/indexer.d.ts +5 -2
- package/dist/conversation-index/indexer.js +1 -1
- package/dist/conversation-index/search.d.ts +2 -1
- package/dist/cross-namespace-budget.js +1 -1
- package/dist/cue-anchors.js +2 -2
- package/dist/dashboard-runtime.d.ts +6 -0
- package/dist/dashboard-runtime.js +3 -3
- package/dist/day-summary.d.ts +1 -0
- package/dist/day-summary.js +2 -2
- package/dist/delinearize.d.ts +1 -0
- package/dist/direct-answer-wiring.d.ts +1 -0
- package/dist/direct-answer.d.ts +1 -0
- package/dist/{dreams-ledger-LR2NBAZE.js → dreams-ledger-3WSCI5V4.js} +5 -4
- package/dist/{dreams-ledger-LR2NBAZE.js.map → dreams-ledger-3WSCI5V4.js.map} +1 -1
- package/dist/embedding-fallback.d.ts +3 -0
- package/dist/embedding-fallback.js +2 -2
- package/dist/enrichment/index.d.ts +1 -0
- package/dist/enrichment/index.js +1 -1
- package/dist/entity-retrieval.d.ts +2 -0
- package/dist/entity-retrieval.js +9 -9
- package/dist/entity-schema.d.ts +1 -0
- package/dist/evals.js +1 -1
- package/dist/explicit-capture.d.ts +5 -3
- package/dist/explicit-capture.js +2 -2
- package/dist/extraction-judge-telemetry.d.ts +2 -0
- package/dist/extraction-judge-training.d.ts +2 -0
- package/dist/extraction-judge.d.ts +2 -0
- package/dist/extraction.d.ts +2 -0
- package/dist/extraction.js +12 -12
- package/dist/{faiss-adapter-CzPghc4C.d.ts → faiss-adapter-BHecI1fF.d.ts} +4 -1
- package/dist/fallback-llm.d.ts +11 -1
- package/dist/fallback-llm.js +8 -6
- package/dist/{first-start-migration-4MHQEOSD.js → first-start-migration-CKTCTCQI.js} +5 -5
- package/dist/graph-dashboard-diff.d.ts +4 -0
- package/dist/graph-dashboard-diff.js +1 -1
- package/dist/graph-dashboard-parser.js +1 -1
- package/dist/{graph-edge-decay-5DI5GUNL.js → graph-edge-decay-MUP5J7CC.js} +6 -6
- package/dist/graph-events.js +1 -1
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph.js +2 -2
- package/dist/harmonic-retrieval.js +4 -4
- package/dist/identity-continuity.d.ts +1 -0
- package/dist/importance.d.ts +1 -0
- package/dist/importers/index.d.ts +244 -0
- package/dist/importers/index.js +20 -0
- package/dist/index.d.ts +20 -350
- package/dist/index.js +885 -562
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +1 -0
- package/dist/lcm/archive.d.ts +2 -2
- package/dist/lcm/archive.js +2 -2
- package/dist/lcm/engine.d.ts +3 -2
- package/dist/lcm/engine.js +6 -6
- package/dist/lcm/index.d.ts +1 -0
- package/dist/lcm/index.js +8 -8
- package/dist/lcm/recall.js +1 -1
- package/dist/lcm/summarizer.js +3 -3
- package/dist/lcm/tools.d.ts +1 -0
- package/dist/lifecycle.d.ts +1 -0
- package/dist/live-connectors-runner.d.ts +1 -0
- package/dist/live-connectors-runner.js +6 -6
- package/dist/local-llm.d.ts +1 -0
- package/dist/local-llm.js +2 -2
- package/dist/maintenance/archive-observations.js +1 -1
- package/dist/maintenance/memory-governance.d.ts +3 -1
- package/dist/maintenance/memory-governance.js +10 -8
- package/dist/maintenance/migrate-observations.js +3 -2
- package/dist/maintenance/observation-ledger-utils.d.ts +3 -0
- package/dist/maintenance/observation-ledger-utils.js +2 -1
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -1
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +11 -8
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -1
- package/dist/maintenance/rebuild-memory-projection.js +13 -10
- package/dist/maintenance/rebuild-observations.d.ts +1 -0
- package/dist/maintenance/rebuild-observations.js +3 -2
- package/dist/mcp-memory-inspector-app.d.ts +7 -4
- package/dist/mcp-memory-inspector-app.js +1 -1
- package/dist/memory-action-policy.d.ts +1 -0
- package/dist/memory-cache.d.ts +1 -0
- package/dist/memory-cache.js +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -0
- package/dist/memory-projection-store.d.ts +1 -0
- package/dist/memory-projection-store.js +1 -1
- package/dist/memory-provenance.d.ts +1 -0
- package/dist/memory-worth-outcomes.d.ts +1 -0
- package/dist/migrate/from-engram.js +2 -2
- package/dist/{migrate-from-identity-anchor-G27MCD6A.js → migrate-from-identity-anchor-EB4XI4Q2.js} +2 -2
- package/dist/model-registry.js +1 -1
- package/dist/models-json.d.ts +1 -0
- package/dist/namespaces/migrate.d.ts +3 -0
- package/dist/namespaces/migrate.js +26 -24
- package/dist/namespaces/principal.d.ts +1 -0
- package/dist/namespaces/principal.js +2 -1
- package/dist/namespaces/search.d.ts +2 -1
- package/dist/namespaces/search.js +17 -15
- package/dist/namespaces/storage.d.ts +4 -2
- package/dist/namespaces/storage.js +10 -9
- package/dist/native-knowledge.d.ts +1 -0
- package/dist/native-knowledge.js +1 -1
- package/dist/negative.js +1 -1
- package/dist/network/webdav.d.ts +16 -1
- package/dist/network/webdav.js +5 -3
- package/dist/objective-state-writers.js +4 -4
- package/dist/objective-state.js +2 -2
- package/dist/offline-sync.d.ts +4 -0
- package/dist/offline-sync.js +4 -4
- package/dist/operator-toolkit.d.ts +4 -1
- package/dist/operator-toolkit.js +37 -34
- package/dist/opik-exporter.js +1 -1
- package/dist/{orchestrator-DuWl9Hwx.d.ts → orchestrator-Co9nxRLF.d.ts} +4 -74
- package/dist/orchestrator.d.ts +5 -3
- package/dist/orchestrator.js +101 -98
- package/dist/page-versioning.js +1 -1
- package/dist/path-X2K5XCHL.js +9 -0
- package/dist/patterns-cli.d.ts +1 -0
- package/dist/peers/index.d.ts +328 -0
- package/dist/{peers-HCVGHMAE.js → peers/index.js} +4 -4
- package/dist/pipeline-D18UAKlN.d.ts +32 -0
- package/dist/plugin-entry-resolver.d.ts +9 -0
- package/dist/plugin-entry-resolver.js +8 -0
- package/dist/plugin-entry-resolver.js.map +1 -0
- package/dist/plugin-id.d.ts +2 -21
- package/dist/plugin-id.js +33 -4
- package/dist/plugin-id.js.map +1 -1
- package/dist/policy-runtime.d.ts +4 -0
- package/dist/policy-runtime.js +1 -1
- package/dist/profiling.js +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -0
- package/dist/qmd.d.ts +2 -1
- package/dist/qmd.js +3 -3
- package/dist/recall-disclosure-escalation.d.ts +1 -0
- package/dist/recall-explain-renderer.d.ts +1 -0
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-state.d.ts +8 -1
- package/dist/recall-state.js +2 -1
- package/dist/recall-tag-filter.d.ts +1 -0
- package/dist/recall-xray-cli.d.ts +1 -0
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -0
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -0
- package/dist/recall-xray.js +2 -2
- package/dist/relevance.d.ts +7 -1
- package/dist/relevance.js +2 -1
- package/dist/replay/normalizers/chatgpt.js +2 -2
- package/dist/replay/normalizers/claude.js +2 -2
- package/dist/replay/normalizers/openclaw.js +2 -2
- package/dist/replay/normalizers/shared.js +1 -1
- package/dist/replay/runner.js +1 -1
- package/dist/rerank.js +1 -1
- package/dist/{resolution-B7FNQSSP.js → resolution-ZY7VM6WS.js} +3 -3
- package/dist/resolution-ZY7VM6WS.js.map +1 -0
- package/dist/resolve-auth-token.d.ts +1 -0
- package/dist/resolve-auth-token.js +1 -1
- package/dist/resolve-provider-secret.d.ts +19 -29
- package/dist/resolve-provider-secret.js +2 -6
- package/dist/resume-bundles.js +10 -9
- package/dist/retrieval-agents.d.ts +2 -1
- package/dist/retrieval-agents.js +2 -1
- package/dist/retrieval-tiers.d.ts +1 -0
- package/dist/routing/engine.d.ts +1 -0
- package/dist/routing/store.d.ts +3 -0
- package/dist/routing/store.js +1 -1
- package/dist/runtime/env.js +1 -1
- package/dist/schemas.d.ts +191 -17
- package/dist/schemas.js +1 -1
- package/dist/sdk-compat.js +1 -1
- package/dist/search/document-scanner.js +1 -1
- package/dist/search/embed-helper.d.ts +7 -2
- package/dist/search/embed-helper.js +3 -1
- package/dist/search/factory.d.ts +2 -1
- package/dist/search/factory.js +15 -14
- package/dist/search/index.d.ts +2 -1
- package/dist/search/index.js +21 -20
- package/dist/search/lancedb-backend.d.ts +8 -7
- package/dist/search/lancedb-backend.js +4 -2
- package/dist/search/meilisearch-backend.d.ts +8 -7
- package/dist/search/meilisearch-backend.js +4 -2
- package/dist/search/noop-backend.d.ts +2 -1
- package/dist/search/noop-backend.js +1 -1
- package/dist/search/orama-backend.d.ts +10 -8
- package/dist/search/orama-backend.js +8 -4
- package/dist/search/port.d.ts +2 -1
- package/dist/search/remote-backend.d.ts +2 -1
- package/dist/search/remote-backend.js +1 -1
- package/dist/secure-store/index.d.ts +16 -3
- package/dist/secure-store/index.js +2 -2
- package/dist/{semantic-VwGI14Ok.d.ts → semantic-SLAa_prH.d.ts} +5 -3
- package/dist/semantic-consolidation.d.ts +1 -0
- package/dist/semantic-consolidation.js +14 -13
- package/dist/semantic-rule-promotion.js +8 -8
- package/dist/semantic-rule-verifier.d.ts +1 -0
- package/dist/semantic-rule-verifier.js +8 -8
- package/dist/session-integrity.d.ts +1 -0
- package/dist/session-integrity.js +1 -1
- package/dist/session-observer-bands.d.ts +1 -0
- package/dist/session-observer-state.d.ts +6 -1
- package/dist/session-observer-state.js +1 -1
- package/dist/shared-context/manager.d.ts +5 -0
- package/dist/shared-context/manager.js +3 -3
- package/dist/signal.d.ts +1 -0
- package/dist/signal.js +1 -1
- package/dist/source-attribution.js +1 -1
- package/dist/state-store-4QZISH3J.js +30 -0
- package/dist/state-store-4QZISH3J.js.map +1 -0
- package/dist/storage-C4DX8CuG.d.ts +157 -0
- package/dist/storage.d.ts +2 -0
- package/dist/storage.js +7 -7
- package/dist/store-contract.js +1 -1
- package/dist/summarizer.d.ts +1 -0
- package/dist/summarizer.js +7 -7
- package/dist/summary-snapshot.d.ts +1 -0
- package/dist/surfaces/dreams.js +48 -17
- package/dist/surfaces/dreams.js.map +1 -1
- package/dist/temporal-supersession.d.ts +1 -0
- package/dist/temporal-supersession.js +1 -1
- package/dist/temporal-validity.d.ts +1 -0
- package/dist/threading.d.ts +1 -0
- package/dist/tier-migration.d.ts +1 -0
- package/dist/tier-routing.d.ts +1 -0
- package/dist/{tier-stats-62ZVDFKS.js → tier-stats-SKML2OSF.js} +5 -5
- package/dist/tmt.js +1 -1
- package/dist/tokens.js +2 -2
- package/dist/topics.d.ts +1 -0
- package/dist/{trace-C5ETWBEF.js → trace-WM7V4CKI.js} +31 -1
- package/dist/trace-WM7V4CKI.js.map +1 -0
- package/dist/transcript.d.ts +1 -0
- package/dist/transcript.js +2 -2
- package/dist/transfer/autodetect.js +7 -7
- package/dist/transfer/backup.js +5 -5
- package/dist/transfer/capsule-export.js +5 -5
- package/dist/transfer/capsule-import.d.ts +6 -0
- package/dist/transfer/capsule-import.js +4 -4
- package/dist/transfer/export-json.js +3 -3
- package/dist/transfer/export-md.js +3 -3
- package/dist/transfer/export-sqlite.js +3 -3
- package/dist/transfer/fs-utils.d.ts +2 -1
- package/dist/transfer/fs-utils.js +5 -3
- package/dist/transfer/import-json.js +3 -3
- package/dist/transfer/import-md.js +3 -3
- package/dist/transfer/import-sqlite.js +3 -3
- package/dist/trust-zones.js +2 -2
- package/dist/types-B1VHaf2w.d.ts +126 -0
- package/dist/types-BliCnURB.d.ts +83 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.js +1 -1
- package/dist/utility-learner.js +3 -3
- package/dist/utility-runtime.d.ts +1 -0
- package/dist/utility-runtime.js +4 -4
- package/dist/utility-telemetry.js +2 -2
- package/dist/verified-recall.js +9 -9
- package/dist/work/board.js +2 -2
- package/dist/work/boundary.js +1 -1
- package/dist/work/storage.d.ts +5 -0
- package/dist/work/storage.js +1 -1
- package/dist/work-product-ledger.js +2 -2
- package/package.json +74 -3
- package/scripts/ensure-better-sqlite3.mjs +8 -7
- package/scripts/faiss_index.py +141 -29
- package/src/access-cli.test.ts +87 -2
- package/src/access-cli.ts +59 -5
- package/src/access-http.test.ts +150 -0
- package/src/access-http.ts +103 -34
- package/src/access-idempotency.ts +136 -3
- package/src/access-mcp.test.ts +155 -0
- package/src/access-mcp.ts +116 -30
- package/src/access-schema.ts +22 -4
- package/src/access-service-namespace.test.ts +9 -9
- package/src/access-service-project-tag.test.ts +37 -0
- package/src/access-service.ts +15 -14
- package/src/active-recall.test.ts +29 -1
- package/src/active-recall.ts +11 -7
- package/src/adapters/claude-code.ts +7 -8
- package/src/adapters/codex.ts +6 -7
- package/src/adapters/hermes.ts +1 -5
- package/src/adapters/registry.test.ts +63 -0
- package/src/adapters/registry.ts +10 -0
- package/src/adapters/replit.ts +5 -7
- package/src/adapters/types.ts +24 -1
- package/src/behavior-signals.ts +1 -1
- package/src/binary-lifecycle/backend.ts +16 -4
- package/src/binary-lifecycle/pipeline.test.ts +149 -0
- package/src/binary-lifecycle/pipeline.ts +49 -7
- package/src/binary-lifecycle/scanner.ts +19 -4
- package/src/boxes.ts +119 -32
- package/src/buffer-session.test.ts +28 -0
- package/src/buffer.ts +10 -14
- package/src/bulk-import/types.ts +10 -0
- package/src/calibration.test.ts +99 -0
- package/src/calibration.ts +57 -13
- package/src/causal-consolidation.test.ts +214 -0
- package/src/causal-consolidation.ts +131 -14
- package/src/causal-retrieval.ts +16 -3
- package/src/citations.test.ts +75 -0
- package/src/citations.ts +19 -6
- package/src/cli.ts +134 -109
- package/src/coding/coding-namespace.test.ts +7 -0
- package/src/coding/coding-namespace.ts +8 -0
- package/src/coding/review-context.test.ts +30 -0
- package/src/coding/review-context.ts +79 -9
- package/src/coding/wire-coding-context.test.ts +16 -0
- package/src/compat/checks.test.ts +33 -0
- package/src/compat/checks.ts +64 -4
- package/src/compounding/engine.ts +2 -2
- package/src/compounding/preference-consolidator.test.ts +47 -0
- package/src/compounding/preference-consolidator.ts +8 -8
- package/src/compression-optimizer.ts +5 -2
- package/src/config.test.ts +34 -2
- package/src/config.ts +62 -18
- package/src/connectors/codex-materialize-runner.ts +4 -3
- package/src/connectors/codex-materialize.ts +149 -34
- package/src/connectors/index.test.ts +144 -7
- package/src/connectors/index.ts +86 -15
- package/src/connectors/live/github.test.ts +47 -0
- package/src/connectors/live/github.ts +29 -1
- package/src/connectors/live/index.ts +2 -0
- package/src/connectors/live/live-connectors.test.ts +359 -73
- package/src/connectors/live/notion.test.ts +84 -0
- package/src/connectors/live/notion.ts +18 -1
- package/src/connectors/live/state-store.ts +419 -38
- package/src/connectors/weclone-installer.test.ts +16 -18
- package/src/connectors-cli.ts +19 -0
- package/src/console/trace.test.ts +28 -0
- package/src/console/trace.ts +42 -5
- package/src/contradiction/contradiction-judge.test.ts +49 -0
- package/src/contradiction/contradiction-judge.ts +15 -5
- package/src/contradiction/contradiction-review.ts +31 -7
- package/src/contradiction/contradiction-scan.ts +28 -18
- package/src/contradiction/contradiction.test.ts +237 -1
- package/src/contradiction/resolution.ts +43 -4
- package/src/conversation-index/backend.ts +13 -5
- package/src/conversation-index/cleanup.ts +25 -4
- package/src/conversation-index/faiss-adapter.ts +24 -15
- package/src/conversation-index/indexer.test.ts +71 -10
- package/src/conversation-index/indexer.ts +22 -3
- package/src/cross-namespace-budget.test.ts +59 -0
- package/src/cross-namespace-budget.ts +15 -7
- package/src/curation/index.ts +18 -17
- package/src/dashboard-runtime.test.ts +98 -0
- package/src/dashboard-runtime.ts +96 -6
- package/src/dedup/index.test.ts +133 -0
- package/src/dedup/index.ts +73 -10
- package/src/dedup/semantic.test.ts +77 -2
- package/src/dedup/semantic.ts +26 -6
- package/src/embedding-fallback.ts +47 -15
- package/src/enrichment/audit.ts +8 -1
- package/src/enrichment/pipeline.ts +21 -13
- package/src/enrichment/web-search-provider.ts +1 -6
- package/src/entity-retrieval.ts +57 -6
- package/src/evals.ts +22 -13
- package/src/explicit-capture.test.ts +40 -0
- package/src/explicit-capture.ts +14 -2
- package/src/extraction.ts +42 -30
- package/src/fallback-llm.ts +35 -2
- package/src/graph-dashboard-diff.test.ts +57 -0
- package/src/graph-dashboard-diff.ts +24 -2
- package/src/graph-dashboard-parser.test.ts +31 -0
- package/src/graph-dashboard-parser.ts +4 -1
- package/src/graph-events.ts +6 -4
- package/src/graph.test.ts +69 -0
- package/src/graph.ts +7 -4
- package/src/importers/base.test.ts +70 -0
- package/src/importers/base.ts +56 -7
- package/src/index.ts +5 -2
- package/src/lcm/archive.ts +65 -16
- package/src/lcm/engine.ts +27 -8
- package/src/lcm/recall.ts +5 -5
- package/src/lcm-engine.test.ts +87 -1
- package/src/lcm-recall.test.ts +71 -0
- package/src/live-connectors-runner.ts +100 -36
- package/src/maintenance/archive-observations.ts +24 -3
- package/src/maintenance/atomic-file.ts +85 -0
- package/src/maintenance/dreams-ledger.ts +15 -8
- package/src/maintenance/memory-governance.test.ts +53 -0
- package/src/maintenance/memory-governance.ts +15 -5
- package/src/maintenance/observation-ledger-utils.ts +6 -5
- package/src/maintenance/purge.test.ts +64 -0
- package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +22 -9
- package/src/maintenance/rebuild-memory-projection.ts +22 -9
- package/src/maintenance/rebuild-observations.ts +7 -3
- package/src/mcp-memory-inspector-app.ts +26 -3
- package/src/memory-cache.test.ts +19 -0
- package/src/memory-cache.ts +1 -0
- package/src/memory-extension/codex-publisher.ts +25 -4
- package/src/memory-extension-host/host-discovery.test.ts +69 -0
- package/src/memory-extension-host/host-discovery.ts +63 -6
- package/src/memory-projection-store.ts +114 -62
- package/src/message-parts/index.ts +46 -31
- package/src/message-parts/message-parts.test.ts +77 -0
- package/src/migrate/from-engram.ts +68 -14
- package/src/model-registry.test.ts +38 -0
- package/src/model-registry.ts +12 -7
- package/src/namespaces/identity.test.ts +66 -0
- package/src/namespaces/identity.ts +23 -0
- package/src/namespaces/migrate.test.ts +62 -0
- package/src/namespaces/migrate.ts +82 -14
- package/src/namespaces/principal.test.ts +37 -1
- package/src/namespaces/principal.ts +18 -7
- package/src/namespaces/search.test.ts +96 -7
- package/src/namespaces/search.ts +32 -25
- package/src/namespaces/storage.ts +93 -11
- package/src/native-knowledge.ts +23 -3
- package/src/negative.ts +50 -5
- package/src/network/webdav.ts +177 -58
- package/src/offline-sync.test.ts +128 -18
- package/src/offline-sync.ts +41 -7
- package/src/onboarding/index.test.ts +105 -0
- package/src/onboarding/index.ts +17 -5
- package/src/operator-toolkit.ts +43 -5
- package/src/orchestrator.ts +120 -27
- package/src/page-versioning.ts +31 -5
- package/src/peers/peers.test.ts +70 -0
- package/src/peers/storage.ts +32 -3
- package/src/plugin-entry-resolver.test.ts +60 -0
- package/src/plugin-entry-resolver.ts +48 -0
- package/src/plugin-id.test.ts +38 -0
- package/src/plugin-id.ts +31 -64
- package/src/policy-runtime.test.ts +75 -0
- package/src/policy-runtime.ts +32 -3
- package/src/procedural/procedure-miner.test.ts +152 -0
- package/src/procedural/procedure-miner.ts +124 -19
- package/src/profiling.test.ts +23 -0
- package/src/profiling.ts +10 -1
- package/src/projection/index.test.ts +253 -0
- package/src/projection/index.ts +159 -18
- package/src/qmd-client.test.ts +45 -0
- package/src/qmd.ts +13 -10
- package/src/recall-disclosure.test.ts +15 -1
- package/src/recall-state.ts +24 -5
- package/src/relevance.ts +24 -5
- package/src/replay/normalizers/chatgpt.ts +14 -4
- package/src/replay/normalizers/claude.ts +8 -3
- package/src/replay/normalizers/openclaw.ts +35 -12
- package/src/replay/normalizers/replay-normalizers.test.ts +65 -0
- package/src/replay/normalizers/shared.ts +4 -1
- package/src/replay/runner.ts +1 -1
- package/src/rerank.test.ts +41 -1
- package/src/rerank.ts +2 -2
- package/src/resolve-auth-token.test.ts +29 -0
- package/src/resolve-auth-token.ts +12 -7
- package/src/resolve-provider-secret.test.ts +78 -22
- package/src/resolve-provider-secret.ts +55 -223
- package/src/retrieval-agents.ts +51 -14
- package/src/review/index.test.ts +75 -1
- package/src/review/index.ts +88 -30
- package/src/routing/store.ts +36 -6
- package/src/runtime/env.test.ts +73 -0
- package/src/runtime/env.ts +7 -11
- package/src/schemas.ts +16 -1
- package/src/search/abort.ts +18 -0
- package/src/search/document-scanner.test.ts +80 -0
- package/src/search/document-scanner.ts +51 -9
- package/src/search/embed-helper.ts +19 -6
- package/src/search/factory.ts +9 -5
- package/src/search/lancedb-backend.ts +66 -23
- package/src/search/meilisearch-backend.ts +39 -13
- package/src/search/noop-backend.ts +1 -1
- package/src/search/orama-backend.test.ts +27 -0
- package/src/search/orama-backend.ts +69 -16
- package/src/search/port.ts +4 -1
- package/src/search/remote-backend.ts +1 -1
- package/src/secure-store/cli-handlers.ts +70 -6
- package/src/secure-store/cli-renderer.ts +13 -7
- package/src/secure-store/secure-fs.ts +11 -5
- package/src/secure-store/secure-store.test.ts +70 -0
- package/src/semantic-consolidation.test.ts +45 -0
- package/src/semantic-consolidation.ts +3 -3
- package/src/session-integrity.test.ts +98 -0
- package/src/session-integrity.ts +51 -1
- package/src/session-observer-state.ts +108 -41
- package/src/shared-context/manager.ts +93 -15
- package/src/signal.test.ts +14 -0
- package/src/signal.ts +8 -1
- package/src/source-attribution.test.ts +8 -0
- package/src/source-attribution.ts +24 -2
- package/src/spaces/index.test.ts +93 -0
- package/src/spaces/index.ts +75 -9
- package/src/storage.ts +14 -1
- package/src/store-contract.test.ts +35 -0
- package/src/store-contract.ts +39 -5
- package/src/summarizer.ts +24 -18
- package/src/summary-snapshot.test.ts +77 -0
- package/src/surfaces/dreams.test.ts +73 -0
- package/src/surfaces/dreams.ts +53 -19
- package/src/sync/index.ts +42 -17
- package/src/taxonomy/taxonomy-loader.ts +43 -4
- package/src/temporal-supersession.test.ts +67 -0
- package/src/temporal-supersession.ts +8 -0
- package/src/tmt.test.ts +50 -0
- package/src/tmt.ts +35 -11
- package/src/tokens.test.ts +18 -0
- package/src/tokens.ts +7 -0
- package/src/training-export/converter.test.ts +55 -2
- package/src/training-export/converter.ts +36 -10
- package/src/training-export/registry.test.ts +17 -0
- package/src/training-export/registry.ts +19 -1
- package/src/transcript.ts +2 -2
- package/src/transfer/backup.ts +18 -7
- package/src/transfer/capsule-crypto.ts +105 -21
- package/src/transfer/capsule-encrypt.test.ts +106 -7
- package/src/transfer/capsule-export.ts +23 -14
- package/src/transfer/capsule-import.ts +11 -2
- package/src/transfer/exclusions.ts +7 -0
- package/src/transfer/export-sqlite.ts +14 -13
- package/src/transfer/fs-utils.ts +52 -1
- package/src/transfer/import-json.ts +12 -7
- package/src/transfer/import-md.ts +5 -5
- package/src/transfer/import-sqlite.ts +4 -5
- package/src/trust-zones.ts +1 -1
- package/src/types.ts +25 -0
- package/src/utility-telemetry.ts +1 -1
- package/src/utils/category-dir.test.ts +15 -0
- package/src/utils/category-dir.ts +3 -1
- package/src/work/boundary.ts +30 -18
- package/src/work/storage.ts +116 -38
- package/src/work-product-ledger.ts +1 -1
- package/dist/chunk-25MQ7IHJ.js.map +0 -1
- package/dist/chunk-2IWUMAES.js.map +0 -1
- package/dist/chunk-2NMMFZ5T.js.map +0 -1
- package/dist/chunk-2PRLKQAH.js.map +0 -1
- package/dist/chunk-326G7DJK.js.map +0 -1
- package/dist/chunk-3APJ5EVB.js.map +0 -1
- package/dist/chunk-3KW65B36.js.map +0 -1
- package/dist/chunk-3QKK7QOS.js.map +0 -1
- package/dist/chunk-3SLRNYNG.js.map +0 -1
- package/dist/chunk-3VAL7ZL2.js.map +0 -1
- package/dist/chunk-3Y4P7RXM.js.map +0 -1
- package/dist/chunk-3ZLVGM76.js.map +0 -1
- package/dist/chunk-43PJZYGL.js.map +0 -1
- package/dist/chunk-47VWKCAF.js.map +0 -1
- package/dist/chunk-4KGVTPGD.js.map +0 -1
- package/dist/chunk-5375UYTQ.js.map +0 -1
- package/dist/chunk-56K5QLHX.js.map +0 -1
- package/dist/chunk-575RMLWN.js.map +0 -1
- package/dist/chunk-5NPGSAVB.js.map +0 -1
- package/dist/chunk-5RGLBDQF.js.map +0 -1
- package/dist/chunk-65PG43EQ.js.map +0 -1
- package/dist/chunk-66DHUKLO.js.map +0 -1
- package/dist/chunk-6LVVDPJ4.js.map +0 -1
- package/dist/chunk-76FLAAUC.js.map +0 -1
- package/dist/chunk-77H5NU3M.js.map +0 -1
- package/dist/chunk-7MNMYOFP.js.map +0 -1
- package/dist/chunk-7OZ53EXP.js.map +0 -1
- package/dist/chunk-7SEAZFFB.js.map +0 -1
- package/dist/chunk-A6KTB5R6.js.map +0 -1
- package/dist/chunk-AGZQD76C.js.map +0 -1
- package/dist/chunk-APO3DCMU.js.map +0 -1
- package/dist/chunk-BVF3AGJP.js.map +0 -1
- package/dist/chunk-C5BCH4ZS.js.map +0 -1
- package/dist/chunk-C7VW7C3F.js.map +0 -1
- package/dist/chunk-CULXMQJH.js.map +0 -1
- package/dist/chunk-CYFQJMUV.js.map +0 -1
- package/dist/chunk-D654IBA6.js +0 -61
- package/dist/chunk-D654IBA6.js.map +0 -1
- package/dist/chunk-DGXUHMOV.js.map +0 -1
- package/dist/chunk-DINWEURR.js.map +0 -1
- package/dist/chunk-DK5LDEQM.js.map +0 -1
- package/dist/chunk-EABGC2TL.js.map +0 -1
- package/dist/chunk-EHRTFRWW.js.map +0 -1
- package/dist/chunk-EJI5XIBB.js.map +0 -1
- package/dist/chunk-FAAFWE4G.js.map +0 -1
- package/dist/chunk-FAJ7FZYM.js +0 -11
- package/dist/chunk-FAJ7FZYM.js.map +0 -1
- package/dist/chunk-FDU6HUUL.js +0 -147
- package/dist/chunk-FDU6HUUL.js.map +0 -1
- package/dist/chunk-FIT6DMX6.js.map +0 -1
- package/dist/chunk-FJ43PRLT.js.map +0 -1
- package/dist/chunk-FLTNHQK6.js +0 -262
- package/dist/chunk-FLTNHQK6.js.map +0 -1
- package/dist/chunk-GDFS42HT.js.map +0 -1
- package/dist/chunk-H3ME6L6D.js.map +0 -1
- package/dist/chunk-HXXBL2KD.js.map +0 -1
- package/dist/chunk-ICRIXAP2.js.map +0 -1
- package/dist/chunk-IQT3XTKW.js.map +0 -1
- package/dist/chunk-JR4ZC3G4.js.map +0 -1
- package/dist/chunk-K4FLSOR5.js.map +0 -1
- package/dist/chunk-KNKUID7G.js.map +0 -1
- package/dist/chunk-KOSORCJG.js.map +0 -1
- package/dist/chunk-LIRZNNUP.js.map +0 -1
- package/dist/chunk-LLQ2LLWF.js.map +0 -1
- package/dist/chunk-LPMVBPA3.js +0 -236
- package/dist/chunk-LPMVBPA3.js.map +0 -1
- package/dist/chunk-LT3NLYSI.js.map +0 -1
- package/dist/chunk-LUDTDZLK.js.map +0 -1
- package/dist/chunk-MJFNCJXV.js.map +0 -1
- package/dist/chunk-MSWG7JI6.js.map +0 -1
- package/dist/chunk-MXC3AP5I.js.map +0 -1
- package/dist/chunk-MXFBBHJU.js.map +0 -1
- package/dist/chunk-MZH6EHNR.js.map +0 -1
- package/dist/chunk-N2D6GXBM.js.map +0 -1
- package/dist/chunk-NBNN5GOB.js.map +0 -1
- package/dist/chunk-NMZY542O.js.map +0 -1
- package/dist/chunk-NZL6GGQE.js.map +0 -1
- package/dist/chunk-OZHRDTDX.js.map +0 -1
- package/dist/chunk-PIRJPV5T.js.map +0 -1
- package/dist/chunk-PZIAX57I.js.map +0 -1
- package/dist/chunk-Q7P4WJDP.js.map +0 -1
- package/dist/chunk-QA2ZAPBU.js.map +0 -1
- package/dist/chunk-QDZ2RLEC.js.map +0 -1
- package/dist/chunk-QLLBRHAT.js.map +0 -1
- package/dist/chunk-QR3C7BKQ.js.map +0 -1
- package/dist/chunk-RHY3HH7P.js.map +0 -1
- package/dist/chunk-RK2Y4XOM.js.map +0 -1
- package/dist/chunk-RR2PKP3I.js +0 -63
- package/dist/chunk-RR2PKP3I.js.map +0 -1
- package/dist/chunk-RRF5UOBJ.js.map +0 -1
- package/dist/chunk-RXDLTSWT.js.map +0 -1
- package/dist/chunk-RYED3SPJ.js +0 -42
- package/dist/chunk-RYED3SPJ.js.map +0 -1
- package/dist/chunk-S7KDBTWT.js.map +0 -1
- package/dist/chunk-TK4UEOSK.js.map +0 -1
- package/dist/chunk-TMM4S4IJ.js.map +0 -1
- package/dist/chunk-TMQLARTH.js.map +0 -1
- package/dist/chunk-TPB3I2AC.js.map +0 -1
- package/dist/chunk-TPMQ3G6Z.js.map +0 -1
- package/dist/chunk-TPU5L5EY.js.map +0 -1
- package/dist/chunk-TZOLIGIG.js.map +0 -1
- package/dist/chunk-U3WSW6PZ.js.map +0 -1
- package/dist/chunk-U4SCL7B7.js.map +0 -1
- package/dist/chunk-U66YHYC7.js +0 -31
- package/dist/chunk-U66YHYC7.js.map +0 -1
- package/dist/chunk-U7EJOMFC.js.map +0 -1
- package/dist/chunk-UWVJF25J.js.map +0 -1
- package/dist/chunk-VBJ7V5SK.js.map +0 -1
- package/dist/chunk-W3LR522O.js.map +0 -1
- package/dist/chunk-W4L6CZKA.js.map +0 -1
- package/dist/chunk-W6AQJ2PY.js.map +0 -1
- package/dist/chunk-WELDCG6C.js.map +0 -1
- package/dist/chunk-WNARATI3.js.map +0 -1
- package/dist/chunk-WPGJYVUH.js.map +0 -1
- package/dist/chunk-WW3QQF4H.js.map +0 -1
- package/dist/chunk-XIG5PDM7.js.map +0 -1
- package/dist/chunk-XKECPATV.js.map +0 -1
- package/dist/chunk-XKLD5OK4.js.map +0 -1
- package/dist/chunk-XSZEP4SF.js.map +0 -1
- package/dist/chunk-XVVIG67A.js.map +0 -1
- package/dist/chunk-XYIK4LF6.js.map +0 -1
- package/dist/chunk-YRMVARQP.js.map +0 -1
- package/dist/chunk-YROHKYBY.js.map +0 -1
- package/dist/chunk-YU5KIWYQ.js.map +0 -1
- package/dist/chunk-ZAVUCJ4H.js.map +0 -1
- package/dist/chunk-ZPKBYX2F.js.map +0 -1
- package/dist/chunk-ZTFCYYEZ.js.map +0 -1
- package/dist/chunk-ZYVPLJ4T.js.map +0 -1
- package/dist/path-MR5JPYOP.js +0 -9
- package/dist/state-store-VZU2IA53.js +0 -16
- package/dist/trace-C5ETWBEF.js.map +0 -1
- /package/dist/{capsule-crypto-5CYAGVC5.js.map → bulk-import/index.js.map} +0 -0
- /package/dist/{contradiction-review-ATP4S6IC.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
- /package/dist/{capsule-merge-4MGKE7C5.js.map → capsule-merge-T2JRE46P.js.map} +0 -0
- /package/dist/{chunk-SAZS2QZB.js.map → chunk-23UORJ4S.js.map} +0 -0
- /package/dist/{chunk-PK7H5L6Y.js.map → chunk-2NM43EWN.js.map} +0 -0
- /package/dist/{chunk-PYXS46O7.js.map → chunk-3BP57I6J.js.map} +0 -0
- /package/dist/{chunk-FBYESMQ2.js.map → chunk-3C5RPJAX.js.map} +0 -0
- /package/dist/{chunk-N53K2EXC.js.map → chunk-6VF75M3X.js.map} +0 -0
- /package/dist/{chunk-6H2TESSP.js.map → chunk-765K3SAT.js.map} +0 -0
- /package/dist/{chunk-EDTHC6UD.js.map → chunk-77NAFXUD.js.map} +0 -0
- /package/dist/{chunk-MGKYQQYF.js.map → chunk-7Q3RCKAQ.js.map} +0 -0
- /package/dist/{chunk-34DQE4KF.js.map → chunk-CO7ZO4TU.js.map} +0 -0
- /package/dist/{chunk-ZKSK55RC.js.map → chunk-ETUPBUHB.js.map} +0 -0
- /package/dist/{chunk-QRNI5JBH.js.map → chunk-EYIEWJNI.js.map} +0 -0
- /package/dist/{chunk-C6QPK5GG.js.map → chunk-FZZ2QTJI.js.map} +0 -0
- /package/dist/{chunk-3JXBXXM2.js.map → chunk-G4IAEX6D.js.map} +0 -0
- /package/dist/{chunk-2WWLHTZY.js.map → chunk-IC4GELZE.js.map} +0 -0
- /package/dist/{chunk-PCUKNJAZ.js.map → chunk-JKV57BTN.js.map} +0 -0
- /package/dist/{chunk-2KI4QFHU.js.map → chunk-LMDRGRJ2.js.map} +0 -0
- /package/dist/{chunk-MY6TPVXW.js.map → chunk-LMPHTYJC.js.map} +0 -0
- /package/dist/{chunk-5HRY2WRF.js.map → chunk-LZ3VEOU5.js.map} +0 -0
- /package/dist/{chunk-NGAVDO7E.js.map → chunk-OADWQ5CR.js.map} +0 -0
- /package/dist/{chunk-DOM4GKSW.js.map → chunk-OZKVVUJB.js.map} +0 -0
- /package/dist/{chunk-MT4HVDUZ.js.map → chunk-PM3QHTFT.js.map} +0 -0
- /package/dist/{chunk-ZK7I7JYV.js.map → chunk-R3PS27B4.js.map} +0 -0
- /package/dist/{chunk-SKE7JYKA.js.map → chunk-SFXKHM7P.js.map} +0 -0
- /package/dist/{chunk-HMDCOMYU.js.map → chunk-SKGV326D.js.map} +0 -0
- /package/dist/{chunk-5UM2VJ6D.js.map → chunk-UEY3VB6W.js.map} +0 -0
- /package/dist/{chunk-GIF42EW3.js.map → chunk-UP6MOYCB.js.map} +0 -0
- /package/dist/{chunk-MRILGULB.js.map → chunk-V2RCP53Q.js.map} +0 -0
- /package/dist/{chunk-FSFEQI74.js.map → chunk-W7L6HXUC.js.map} +0 -0
- /package/dist/{chunk-3IQ2TR4N.js.map → chunk-WLEB7WCG.js.map} +0 -0
- /package/dist/{chunk-GL6I6MEQ.js.map → chunk-WSGF57U2.js.map} +0 -0
- /package/dist/{chunk-JA3AK3PT.js.map → chunk-XNLXAWHX.js.map} +0 -0
- /package/dist/{chunk-SIC6U3GZ.js.map → chunk-YHV3KRKS.js.map} +0 -0
- /package/dist/{chunk-VLXA6PI2.js.map → chunk-YQMZ7IH2.js.map} +0 -0
- /package/dist/{contradiction-scan-5A4IDZV5.js.map → contradiction-review-6V2LXXK6.js.map} +0 -0
- /package/dist/{migrate-from-identity-anchor-G27MCD6A.js.map → contradiction-scan-GIRVC4C7.js.map} +0 -0
- /package/dist/{first-start-migration-4MHQEOSD.js.map → first-start-migration-CKTCTCQI.js.map} +0 -0
- /package/dist/{graph-edge-decay-5DI5GUNL.js.map → graph-edge-decay-MUP5J7CC.js.map} +0 -0
- /package/dist/{path-MR5JPYOP.js.map → importers/index.js.map} +0 -0
- /package/dist/{peers-HCVGHMAE.js.map → migrate-from-identity-anchor-EB4XI4Q2.js.map} +0 -0
- /package/dist/{resolution-B7FNQSSP.js.map → path-X2K5XCHL.js.map} +0 -0
- /package/dist/{state-store-VZU2IA53.js.map → peers/index.js.map} +0 -0
- /package/dist/{tier-stats-62ZVDFKS.js.map → tier-stats-SKML2OSF.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-SFXKHM7P.js";
|
|
2
2
|
import {
|
|
3
3
|
PEERS_DIR_NAME,
|
|
4
4
|
PEER_ID_MAX_LENGTH,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
readPeerProfile,
|
|
12
12
|
writePeer,
|
|
13
13
|
writePeerProfile
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PRQJ5ESM.js";
|
|
15
15
|
import {
|
|
16
16
|
EnrichmentProviderRegistry,
|
|
17
17
|
WebSearchProvider,
|
|
@@ -19,7 +19,15 @@ import {
|
|
|
19
19
|
defaultEnrichmentPipelineConfig,
|
|
20
20
|
readAuditLog,
|
|
21
21
|
runEnrichmentPipeline
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-HINSGUA7.js";
|
|
23
|
+
import {
|
|
24
|
+
DEFAULT_IMPORT_BATCH_SIZE,
|
|
25
|
+
defaultWriteMemoriesToOrchestrator,
|
|
26
|
+
importedMemoryToTurn,
|
|
27
|
+
runImporter,
|
|
28
|
+
validateImportBatchSize,
|
|
29
|
+
validateImportRateLimit
|
|
30
|
+
} from "./chunk-LUDUFZTV.js";
|
|
23
31
|
import {
|
|
24
32
|
MARKETPLACE_MANIFEST_FILENAME,
|
|
25
33
|
MARKETPLACE_SCHEMA_VERSION,
|
|
@@ -35,17 +43,17 @@ import {
|
|
|
35
43
|
saveRegistry,
|
|
36
44
|
validateMarketplaceManifest,
|
|
37
45
|
writeMarketplaceManifest
|
|
38
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-RW5DGAGO.js";
|
|
39
47
|
import "./chunk-V5OCT34X.js";
|
|
40
48
|
import {
|
|
41
49
|
executeResolution,
|
|
42
50
|
isValidResolutionVerb
|
|
43
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-XSQ4SGM5.js";
|
|
44
52
|
import {
|
|
45
53
|
ACTIVE_STATUSES,
|
|
46
54
|
judgeContradictionPairs,
|
|
47
55
|
runContradictionScan
|
|
48
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-YR7XMOWK.js";
|
|
49
57
|
import {
|
|
50
58
|
computePairId,
|
|
51
59
|
isCoolingDown,
|
|
@@ -54,7 +62,7 @@ import {
|
|
|
54
62
|
resolvePair,
|
|
55
63
|
writePair,
|
|
56
64
|
writePairs
|
|
57
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-HLAVGJ62.js";
|
|
58
66
|
import {
|
|
59
67
|
generateToken,
|
|
60
68
|
getAllValidTokens,
|
|
@@ -64,7 +72,7 @@ import {
|
|
|
64
72
|
resolveConnectorFromToken,
|
|
65
73
|
revokeToken,
|
|
66
74
|
saveTokenStore
|
|
67
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-G56P5RLD.js";
|
|
68
76
|
import {
|
|
69
77
|
runGraphRecall
|
|
70
78
|
} from "./chunk-DGVM5SFL.js";
|
|
@@ -79,69 +87,75 @@ import {
|
|
|
79
87
|
queryGraph
|
|
80
88
|
} from "./chunk-64NJRYU2.js";
|
|
81
89
|
import {
|
|
82
|
-
clearBulkImportSources,
|
|
83
90
|
clearTrainingExportAdapters,
|
|
84
91
|
convertMemoriesToRecords,
|
|
85
|
-
formatBatchTranscript,
|
|
86
|
-
getBulkImportSource,
|
|
87
92
|
getTrainingExportAdapter,
|
|
88
|
-
isImportRole,
|
|
89
|
-
listBulkImportSources,
|
|
90
93
|
listTrainingExportAdapters,
|
|
91
|
-
parseIsoTimestamp,
|
|
92
|
-
registerBulkImportSource,
|
|
93
94
|
registerTrainingExportAdapter,
|
|
94
|
-
runBulkImportCliCommand
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
import "./chunk-
|
|
99
|
-
import "./chunk-
|
|
100
|
-
import "./chunk-
|
|
101
|
-
import "./chunk-
|
|
102
|
-
import "./chunk-
|
|
103
|
-
import "./chunk-
|
|
104
|
-
import "./chunk-DOM4GKSW.js";
|
|
105
|
-
import "./chunk-W4L6CZKA.js";
|
|
106
|
-
import "./chunk-3JXBXXM2.js";
|
|
107
|
-
import "./chunk-7OZ53EXP.js";
|
|
108
|
-
import "./chunk-GIF42EW3.js";
|
|
109
|
-
import "./chunk-6H2TESSP.js";
|
|
110
|
-
import "./chunk-66DHUKLO.js";
|
|
95
|
+
runBulkImportCliCommand
|
|
96
|
+
} from "./chunk-FCOQXV3T.js";
|
|
97
|
+
import "./chunk-7F7Z6MOS.js";
|
|
98
|
+
import "./chunk-MC4FJXPA.js";
|
|
99
|
+
import "./chunk-LQHDIS7L.js";
|
|
100
|
+
import "./chunk-JJEJJ7RK.js";
|
|
101
|
+
import "./chunk-UP6MOYCB.js";
|
|
102
|
+
import "./chunk-XSWKORGM.js";
|
|
103
|
+
import "./chunk-HDDRVXX4.js";
|
|
104
|
+
import "./chunk-4RR6ROTB.js";
|
|
111
105
|
import "./chunk-Z734BLO3.js";
|
|
106
|
+
import "./chunk-OZKVVUJB.js";
|
|
107
|
+
import "./chunk-2DL3OFLD.js";
|
|
108
|
+
import "./chunk-G4IAEX6D.js";
|
|
109
|
+
import "./chunk-2NLLXCJG.js";
|
|
110
|
+
import "./chunk-765K3SAT.js";
|
|
112
111
|
import "./chunk-TKWGAOLV.js";
|
|
113
|
-
import "./chunk-
|
|
114
|
-
import "./chunk-
|
|
115
|
-
import "./chunk-
|
|
116
|
-
import "./chunk-
|
|
117
|
-
import "./chunk-
|
|
118
|
-
import "./chunk-
|
|
112
|
+
import "./chunk-UWY7GIVS.js";
|
|
113
|
+
import "./chunk-HOJZMQ4J.js";
|
|
114
|
+
import "./chunk-2NM43EWN.js";
|
|
115
|
+
import "./chunk-LJBOVCQG.js";
|
|
116
|
+
import "./chunk-E62SBGQ3.js";
|
|
117
|
+
import "./chunk-XR6DNK4U.js";
|
|
118
|
+
import "./chunk-RUZOJKNF.js";
|
|
119
|
+
import "./chunk-S7WU3Y3D.js";
|
|
119
120
|
import "./chunk-KJTKLXTH.js";
|
|
120
|
-
import
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
import {
|
|
122
|
+
clearBulkImportSources,
|
|
123
|
+
formatBatchTranscript,
|
|
124
|
+
getBulkImportSource,
|
|
125
|
+
listBulkImportSources,
|
|
126
|
+
registerBulkImportSource,
|
|
127
|
+
resolveBulkImportContext,
|
|
128
|
+
runBulkImportPipeline,
|
|
129
|
+
validateBatchSize
|
|
130
|
+
} from "./chunk-H2NCNXMS.js";
|
|
131
|
+
import {
|
|
132
|
+
isImportRole,
|
|
133
|
+
parseIsoTimestamp,
|
|
134
|
+
validateImportTurn
|
|
135
|
+
} from "./chunk-PU44GBL4.js";
|
|
136
|
+
import "./chunk-YR6GIWWY.js";
|
|
137
|
+
import "./chunk-V2RCP53Q.js";
|
|
138
|
+
import "./chunk-R3PS27B4.js";
|
|
124
139
|
import {
|
|
125
140
|
clearAuthTokenSecretCache,
|
|
126
141
|
isAgentAccessSecretRef,
|
|
127
142
|
resolveAgentAccessAuthToken
|
|
128
|
-
} from "./chunk-
|
|
129
|
-
import "./chunk-ZK7I7JYV.js";
|
|
143
|
+
} from "./chunk-TGQ2NTWH.js";
|
|
130
144
|
import {
|
|
131
145
|
parseXrayBudgetFlag,
|
|
132
146
|
parseXrayCliOptions
|
|
133
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-PM3QHTFT.js";
|
|
134
148
|
import {
|
|
135
149
|
parseStrictCliDate
|
|
136
150
|
} from "./chunk-AJA46VX5.js";
|
|
137
|
-
import "./chunk-
|
|
138
|
-
import "./chunk-
|
|
151
|
+
import "./chunk-YNXOKMJP.js";
|
|
152
|
+
import "./chunk-6BR7L222.js";
|
|
139
153
|
import "./chunk-HL4DB7TO.js";
|
|
140
|
-
import "./chunk-
|
|
141
|
-
import "./chunk-
|
|
142
|
-
import "./chunk-
|
|
154
|
+
import "./chunk-YNDLCWXS.js";
|
|
155
|
+
import "./chunk-AUDJPF4N.js";
|
|
156
|
+
import "./chunk-44442YCH.js";
|
|
143
157
|
import "./chunk-Y4Z4I6WK.js";
|
|
144
|
-
import "./chunk-
|
|
158
|
+
import "./chunk-LZ3VEOU5.js";
|
|
145
159
|
import {
|
|
146
160
|
reportBufferSurpriseDistribution
|
|
147
161
|
} from "./chunk-YBPYIAA5.js";
|
|
@@ -152,88 +166,84 @@ import {
|
|
|
152
166
|
import {
|
|
153
167
|
getMemoryForActiveMemory,
|
|
154
168
|
recallForActiveMemory
|
|
155
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-IC4GELZE.js";
|
|
156
170
|
import "./chunk-6MKAMLQL.js";
|
|
157
171
|
import {
|
|
158
172
|
DEFAULT_TAXONOMY,
|
|
159
173
|
Orchestrator,
|
|
160
|
-
branchNamespaceName,
|
|
161
174
|
buildProcedureRecallSection,
|
|
162
175
|
decideSemanticDedup,
|
|
163
176
|
defaultWorkspaceDir,
|
|
164
|
-
describeCodingScope,
|
|
165
177
|
generateResolverDocument,
|
|
166
178
|
getTaxonomyDir,
|
|
167
179
|
getTaxonomyFilePath,
|
|
168
180
|
loadTaxonomy,
|
|
169
|
-
projectNamespaceName,
|
|
170
|
-
resolveCodingNamespaceOverlay,
|
|
171
181
|
sanitizeSessionKeyForFilename,
|
|
172
182
|
saveTaxonomy,
|
|
173
183
|
validateSlug,
|
|
174
184
|
validateTaxonomy
|
|
175
|
-
} from "./chunk-
|
|
176
|
-
import "./chunk-
|
|
185
|
+
} from "./chunk-YDMVYYD2.js";
|
|
186
|
+
import "./chunk-Y2SXZ5KZ.js";
|
|
187
|
+
import "./chunk-BFBF3XEF.js";
|
|
177
188
|
import {
|
|
178
189
|
migrateFromEngram,
|
|
179
190
|
rollbackFromEngramMigration
|
|
180
|
-
} from "./chunk-
|
|
181
|
-
import "./chunk-BFBF3XEF.js";
|
|
191
|
+
} from "./chunk-S53PKKWK.js";
|
|
182
192
|
import "./chunk-HHLLAQGZ.js";
|
|
183
193
|
import "./chunk-UWK5OXUJ.js";
|
|
184
|
-
import "./chunk-
|
|
194
|
+
import "./chunk-RLV3PQGH.js";
|
|
195
|
+
import "./chunk-TPDBFYEG.js";
|
|
196
|
+
import "./chunk-KCYE2MZM.js";
|
|
185
197
|
import {
|
|
186
198
|
applyLcmSchema,
|
|
187
199
|
ensureLcmStateDir,
|
|
188
200
|
openLcmDatabase
|
|
189
201
|
} from "./chunk-7XYTQGCC.js";
|
|
190
|
-
import "./chunk-
|
|
191
|
-
import "./chunk-
|
|
202
|
+
import "./chunk-CO7ZO4TU.js";
|
|
203
|
+
import "./chunk-4HP7HIE3.js";
|
|
192
204
|
import "./chunk-7N4KAIGN.js";
|
|
193
|
-
import "./chunk-TPDBFYEG.js";
|
|
194
|
-
import "./chunk-ZTFCYYEZ.js";
|
|
195
205
|
import "./chunk-TECVW3JP.js";
|
|
196
|
-
import "./chunk-
|
|
197
|
-
import "./chunk-
|
|
198
|
-
import "./chunk-
|
|
206
|
+
import "./chunk-T2PO5MUF.js";
|
|
207
|
+
import "./chunk-IQ3OI2RR.js";
|
|
208
|
+
import "./chunk-DRD2Q7HQ.js";
|
|
199
209
|
import "./chunk-UHGBNIOS.js";
|
|
200
|
-
import "./chunk-
|
|
201
|
-
import "./chunk-
|
|
210
|
+
import "./chunk-W7L6HXUC.js";
|
|
211
|
+
import "./chunk-K5O2QY6T.js";
|
|
202
212
|
import "./chunk-MDYG7VI7.js";
|
|
203
213
|
import "./chunk-Z5AAYHUC.js";
|
|
204
214
|
import {
|
|
205
215
|
computeTierValueScore,
|
|
206
216
|
decideTierTransition
|
|
207
217
|
} from "./chunk-S75M5ZRK.js";
|
|
208
|
-
import "./chunk-
|
|
209
|
-
import "./chunk-
|
|
218
|
+
import "./chunk-ECZU5BJH.js";
|
|
219
|
+
import "./chunk-46GJIW5M.js";
|
|
210
220
|
import "./chunk-XJNBEDFE.js";
|
|
211
221
|
import {
|
|
212
222
|
buildTargetedFactRecallSection,
|
|
213
223
|
shouldRecallTargetedFactEvidence
|
|
214
224
|
} from "./chunk-VWT3F4IV.js";
|
|
215
|
-
import "./chunk-
|
|
216
|
-
import "./chunk-
|
|
225
|
+
import "./chunk-DLJ4IR6M.js";
|
|
226
|
+
import "./chunk-USYGGIJZ.js";
|
|
217
227
|
import "./chunk-V3RXWQIE.js";
|
|
218
228
|
import "./chunk-5IZL4DCV.js";
|
|
219
229
|
import "./chunk-X7XN6YU4.js";
|
|
220
|
-
import "./chunk-
|
|
221
|
-
import "./chunk-
|
|
230
|
+
import "./chunk-XEKAG3FM.js";
|
|
231
|
+
import "./chunk-TDKQGLJW.js";
|
|
222
232
|
import {
|
|
223
233
|
buildResponseGuidanceRecallSection,
|
|
224
234
|
shouldRecallResponseGuidance
|
|
225
235
|
} from "./chunk-OZKZ2TRP.js";
|
|
236
|
+
import "./chunk-YDBIWGNI.js";
|
|
226
237
|
import "./chunk-7DHTMOND.js";
|
|
227
|
-
import "./chunk-
|
|
238
|
+
import "./chunk-MGVIEM2O.js";
|
|
239
|
+
import "./chunk-YCN4BVDK.js";
|
|
228
240
|
import {
|
|
229
241
|
DEFAULT_REASONING_TRACE_BOOST,
|
|
230
242
|
applyReasoningTraceBoost,
|
|
231
243
|
isReasoningTracePath,
|
|
232
244
|
looksLikeProblemSolvingQuery
|
|
233
245
|
} from "./chunk-ZZTOURJI.js";
|
|
234
|
-
import "./chunk-
|
|
235
|
-
import "./chunk-YCN4BVDK.js";
|
|
236
|
-
import "./chunk-D654IBA6.js";
|
|
246
|
+
import "./chunk-XKXKSQU7.js";
|
|
237
247
|
import {
|
|
238
248
|
applyMemoryWorthFilter,
|
|
239
249
|
buildMemoryWorthCounterMap
|
|
@@ -245,7 +255,7 @@ import {
|
|
|
245
255
|
builtInLiveConnectorDefinitions,
|
|
246
256
|
hasEnabledLiveConnector,
|
|
247
257
|
runLiveConnectorsOnce
|
|
248
|
-
} from "./chunk-
|
|
258
|
+
} from "./chunk-QMYXNM4P.js";
|
|
249
259
|
import "./chunk-H63EDPFJ.js";
|
|
250
260
|
import {
|
|
251
261
|
hasBroadGraphIntent,
|
|
@@ -268,21 +278,21 @@ import {
|
|
|
268
278
|
} from "./chunk-C4SQJZAF.js";
|
|
269
279
|
import {
|
|
270
280
|
ExtractionEngine
|
|
271
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-KM2A35EO.js";
|
|
272
282
|
import "./chunk-4RA3C3EV.js";
|
|
273
|
-
import "./chunk-
|
|
283
|
+
import "./chunk-ROZJACKP.js";
|
|
274
284
|
import "./chunk-54V4BZWP.js";
|
|
275
285
|
import {
|
|
276
286
|
ModelRegistry
|
|
277
|
-
} from "./chunk-
|
|
278
|
-
import "./chunk-
|
|
287
|
+
} from "./chunk-XZ4WBBB5.js";
|
|
288
|
+
import "./chunk-77NAFXUD.js";
|
|
279
289
|
import {
|
|
280
290
|
buildFocusedListRecallSection,
|
|
281
291
|
shouldRecallFocusedListEvidence
|
|
282
292
|
} from "./chunk-DB5A3NHS.js";
|
|
283
293
|
import {
|
|
284
294
|
buildEntityRecallSection
|
|
285
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-FPGE5NVO.js";
|
|
286
296
|
import {
|
|
287
297
|
buildEventOrderRecallSection,
|
|
288
298
|
shouldRecallEventOrderEvidence
|
|
@@ -305,7 +315,7 @@ import {
|
|
|
305
315
|
import {
|
|
306
316
|
buildExtensionsFooterForSummary,
|
|
307
317
|
loadDaySummaryPrompt
|
|
308
|
-
} from "./chunk-
|
|
318
|
+
} from "./chunk-WLEB7WCG.js";
|
|
309
319
|
import "./chunk-VEWZZM3H.js";
|
|
310
320
|
import {
|
|
311
321
|
resolveCategory
|
|
@@ -314,72 +324,77 @@ import {
|
|
|
314
324
|
FILTER_LABELS,
|
|
315
325
|
isDirectAnswerEligible
|
|
316
326
|
} from "./chunk-Y4FHOFJ2.js";
|
|
317
|
-
import "./chunk-
|
|
327
|
+
import "./chunk-6URPAY2D.js";
|
|
318
328
|
import {
|
|
319
329
|
CODEX_THREAD_KEY_PREFIX
|
|
320
330
|
} from "./chunk-3PG3H5TD.js";
|
|
321
|
-
import "./chunk-
|
|
331
|
+
import "./chunk-OD4FM2U7.js";
|
|
322
332
|
import {
|
|
323
333
|
buildExtensionsBlockForConsolidation
|
|
324
|
-
} from "./chunk-
|
|
334
|
+
} from "./chunk-6XSPNR6L.js";
|
|
325
335
|
import {
|
|
326
336
|
runCodexMaterialize,
|
|
327
337
|
runPostConsolidationMaterialize
|
|
328
|
-
} from "./chunk-
|
|
338
|
+
} from "./chunk-6F6BXB7A.js";
|
|
329
339
|
import {
|
|
330
340
|
MATERIALIZE_VERSION,
|
|
331
341
|
SENTINEL_FILE,
|
|
332
342
|
describeMemoriesDir,
|
|
333
343
|
ensureSentinel,
|
|
334
344
|
materializeForNamespace
|
|
335
|
-
} from "./chunk-
|
|
345
|
+
} from "./chunk-JFEKNTX7.js";
|
|
336
346
|
import {
|
|
337
347
|
REMNIC_EXTENSIONS_TOTAL_TOKEN_LIMIT,
|
|
338
348
|
discoverMemoryExtensions,
|
|
339
349
|
renderExtensionsBlock,
|
|
340
350
|
renderExtensionsFooter,
|
|
341
351
|
resolveExtensionsRoot
|
|
342
|
-
} from "./chunk-
|
|
352
|
+
} from "./chunk-JLNBQWZ2.js";
|
|
353
|
+
import "./chunk-HPWVAEET.js";
|
|
343
354
|
import "./chunk-2PRQG7PV.js";
|
|
344
|
-
import "./chunk-
|
|
345
|
-
import "./chunk-
|
|
346
|
-
import "./chunk-
|
|
347
|
-
import "./chunk-3QKK7QOS.js";
|
|
355
|
+
import "./chunk-XNLXAWHX.js";
|
|
356
|
+
import "./chunk-3BP57I6J.js";
|
|
357
|
+
import "./chunk-TERNBNJB.js";
|
|
348
358
|
import "./chunk-W4RVMTHR.js";
|
|
349
|
-
import "./chunk-
|
|
350
|
-
import "./chunk-
|
|
351
|
-
import "./chunk-
|
|
359
|
+
import "./chunk-23UORJ4S.js";
|
|
360
|
+
import "./chunk-XPXEJRUB.js";
|
|
361
|
+
import "./chunk-A6D7A2FW.js";
|
|
352
362
|
import "./chunk-FF4KLI5W.js";
|
|
353
|
-
import "./chunk-
|
|
354
|
-
import "./chunk-
|
|
355
|
-
import "./chunk-
|
|
356
|
-
import "./chunk-
|
|
357
|
-
import "./chunk-NJ3MJQZX.js";
|
|
358
|
-
import {
|
|
359
|
-
OramaBackend
|
|
360
|
-
} from "./chunk-XVVIG67A.js";
|
|
361
|
-
import "./chunk-PIRJPV5T.js";
|
|
362
|
-
import "./chunk-RXDLTSWT.js";
|
|
363
|
+
import "./chunk-4426WSWL.js";
|
|
364
|
+
import "./chunk-A2Z6UCWT.js";
|
|
365
|
+
import "./chunk-KXULCVOC.js";
|
|
366
|
+
import "./chunk-SML26KED.js";
|
|
363
367
|
import {
|
|
364
368
|
LanceDbBackend
|
|
365
|
-
} from "./chunk-
|
|
369
|
+
} from "./chunk-FUC4LZMD.js";
|
|
366
370
|
import {
|
|
367
371
|
MeilisearchBackend
|
|
368
|
-
} from "./chunk-
|
|
369
|
-
import "./chunk-
|
|
370
|
-
import
|
|
372
|
+
} from "./chunk-FK556DDH.js";
|
|
373
|
+
import "./chunk-2I5JGH3M.js";
|
|
374
|
+
import {
|
|
375
|
+
OramaBackend
|
|
376
|
+
} from "./chunk-QVJ4NWL2.js";
|
|
377
|
+
import "./chunk-JNANKJLN.js";
|
|
378
|
+
import "./chunk-Q4CAQGKQ.js";
|
|
379
|
+
import "./chunk-ONPLNAPX.js";
|
|
380
|
+
import "./chunk-CINZGPSJ.js";
|
|
381
|
+
import {
|
|
382
|
+
ALL_CATEGORY_DIRS,
|
|
383
|
+
ALL_CATEGORY_KEYS,
|
|
384
|
+
getCategoryDir
|
|
385
|
+
} from "./chunk-CHBI22MI.js";
|
|
386
|
+
import "./chunk-ZFXCQPNO.js";
|
|
387
|
+
import "./chunk-KIB7SDIJ.js";
|
|
388
|
+
import "./chunk-ORFGK3XI.js";
|
|
389
|
+
import "./chunk-HENLZHIT.js";
|
|
371
390
|
import "./chunk-7DTASS5T.js";
|
|
372
|
-
import "./chunk-
|
|
373
|
-
import "./chunk-LLQ2LLWF.js";
|
|
374
|
-
import "./chunk-YRMVARQP.js";
|
|
391
|
+
import "./chunk-KFY3SGN7.js";
|
|
375
392
|
import {
|
|
376
393
|
QmdClient
|
|
377
|
-
} from "./chunk-
|
|
394
|
+
} from "./chunk-PCI747N2.js";
|
|
378
395
|
import {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
resolveRemnicPluginEntry
|
|
382
|
-
} from "./chunk-U66YHYC7.js";
|
|
396
|
+
resolvePluginEntry
|
|
397
|
+
} from "./chunk-CMTINOFS.js";
|
|
383
398
|
import {
|
|
384
399
|
DEFAULT_POLL_INTERVAL_MS,
|
|
385
400
|
GOOGLE_DRIVE_CONNECTOR_ID,
|
|
@@ -394,21 +409,21 @@ import {
|
|
|
394
409
|
defaultGoogleDriveClientFactory,
|
|
395
410
|
validateGoogleDriveConfig,
|
|
396
411
|
validateNotionConfig
|
|
397
|
-
} from "./chunk-
|
|
412
|
+
} from "./chunk-BECQDWBA.js";
|
|
398
413
|
import {
|
|
399
414
|
CONNECTOR_ID_PATTERN,
|
|
400
415
|
isValidConnectorId,
|
|
401
416
|
listConnectorStates,
|
|
402
417
|
readConnectorState,
|
|
403
418
|
writeConnectorState
|
|
404
|
-
} from "./chunk-
|
|
419
|
+
} from "./chunk-CWWMTTQE.js";
|
|
405
420
|
import "./chunk-JXS5PDQ7.js";
|
|
406
|
-
import "./chunk-
|
|
407
|
-
import "./chunk-
|
|
408
|
-
import "./chunk-
|
|
421
|
+
import "./chunk-SKGV326D.js";
|
|
422
|
+
import "./chunk-BEUDU7Y4.js";
|
|
423
|
+
import "./chunk-G3Z3QEF5.js";
|
|
409
424
|
import "./chunk-AJU4PJGY.js";
|
|
410
|
-
import "./chunk-
|
|
411
|
-
import "./chunk-
|
|
425
|
+
import "./chunk-FZZ2QTJI.js";
|
|
426
|
+
import "./chunk-LMDRGRJ2.js";
|
|
412
427
|
import {
|
|
413
428
|
CONNECTORS_OUTPUT_FORMATS,
|
|
414
429
|
parseConnectorsFormat,
|
|
@@ -418,17 +433,17 @@ import {
|
|
|
418
433
|
renderConnectorsList,
|
|
419
434
|
renderConnectorsRunResult,
|
|
420
435
|
runConnectorPollOnce
|
|
421
|
-
} from "./chunk-
|
|
436
|
+
} from "./chunk-OKTXM5H4.js";
|
|
422
437
|
import "./chunk-3UXOZBHV.js";
|
|
423
438
|
import "./chunk-KVE7R4CG.js";
|
|
424
439
|
import "./chunk-4WMCPJWX.js";
|
|
425
440
|
import {
|
|
426
441
|
SmartBuffer
|
|
427
|
-
} from "./chunk-
|
|
442
|
+
} from "./chunk-EVZFIAPG.js";
|
|
428
443
|
import {
|
|
429
444
|
FallbackLlmClient
|
|
430
|
-
} from "./chunk-
|
|
431
|
-
import "./chunk-
|
|
445
|
+
} from "./chunk-CSKLPDN6.js";
|
|
446
|
+
import "./chunk-B5XMS73R.js";
|
|
432
447
|
import "./chunk-7SI52C65.js";
|
|
433
448
|
import "./chunk-L2EXJQJP.js";
|
|
434
449
|
import "./chunk-UZB5KHKX.js";
|
|
@@ -439,33 +454,33 @@ import {
|
|
|
439
454
|
isOpenaiApiKeyDisabled,
|
|
440
455
|
parseConfig,
|
|
441
456
|
resolveEnvVars
|
|
442
|
-
} from "./chunk-
|
|
457
|
+
} from "./chunk-7H6CFEBJ.js";
|
|
443
458
|
import {
|
|
444
459
|
coerceInstallExtension
|
|
445
460
|
} from "./chunk-PHK3HARR.js";
|
|
446
461
|
import "./chunk-Z5LAYHGJ.js";
|
|
447
462
|
import "./chunk-6HZ6AO2P.js";
|
|
448
|
-
import "./chunk-
|
|
463
|
+
import "./chunk-KD3QD3A5.js";
|
|
449
464
|
import {
|
|
450
465
|
BootstrapEngine
|
|
451
|
-
} from "./chunk-
|
|
452
|
-
import "./chunk-
|
|
453
|
-
import "./chunk-
|
|
466
|
+
} from "./chunk-6VF75M3X.js";
|
|
467
|
+
import "./chunk-H3FZVNRN.js";
|
|
468
|
+
import "./chunk-HQ6NIBL6.js";
|
|
454
469
|
import "./chunk-PVGDJXVK.js";
|
|
455
|
-
import "./chunk-
|
|
470
|
+
import "./chunk-OADWQ5CR.js";
|
|
456
471
|
import {
|
|
457
472
|
EngramAccessHttpServer
|
|
458
|
-
} from "./chunk-
|
|
473
|
+
} from "./chunk-HC6EKOID.js";
|
|
459
474
|
import "./chunk-SEDEKFYQ.js";
|
|
460
|
-
import "./chunk-
|
|
461
|
-
import "./chunk-
|
|
462
|
-
import "./chunk-
|
|
463
|
-
import "./chunk-
|
|
464
|
-
import "./chunk-
|
|
465
|
-
import "./chunk-
|
|
475
|
+
import "./chunk-JBPKEARU.js";
|
|
476
|
+
import "./chunk-TMSXWOBZ.js";
|
|
477
|
+
import "./chunk-J64TK33U.js";
|
|
478
|
+
import "./chunk-RSUYKGGZ.js";
|
|
479
|
+
import "./chunk-42NQ7AVG.js";
|
|
480
|
+
import "./chunk-7RXCMVFQ.js";
|
|
466
481
|
import {
|
|
467
482
|
EngramMcpServer
|
|
468
|
-
} from "./chunk-
|
|
483
|
+
} from "./chunk-TTGZV5R3.js";
|
|
469
484
|
import {
|
|
470
485
|
REMNIC_CHATGPT_MEMORY_INSPECTOR_CANONICAL_TOOL,
|
|
471
486
|
REMNIC_CHATGPT_MEMORY_INSPECTOR_MIME_TYPE,
|
|
@@ -474,24 +489,24 @@ import {
|
|
|
474
489
|
REMNIC_CHATGPT_MEMORY_INSPECTOR_WIDGET_URI,
|
|
475
490
|
buildChatGptMemoryInspectorActionRequest,
|
|
476
491
|
buildChatGptMemoryInspectorResult
|
|
477
|
-
} from "./chunk-
|
|
492
|
+
} from "./chunk-EAZGEEG2.js";
|
|
478
493
|
import {
|
|
479
494
|
buildCitationGuidance,
|
|
480
495
|
formatOaiMemCitation,
|
|
481
496
|
parseOaiMemCitation,
|
|
482
497
|
sanitizeNoteForCitation
|
|
483
|
-
} from "./chunk-
|
|
498
|
+
} from "./chunk-D24OXEPB.js";
|
|
484
499
|
import {
|
|
485
500
|
EngramAccessInputError,
|
|
486
501
|
EngramAccessService,
|
|
487
502
|
computeProcedureStats,
|
|
488
503
|
formatProcedureStatsText
|
|
489
|
-
} from "./chunk-
|
|
490
|
-
import "./chunk-
|
|
491
|
-
import "./chunk-
|
|
504
|
+
} from "./chunk-5V456VRV.js";
|
|
505
|
+
import "./chunk-ETUPBUHB.js";
|
|
506
|
+
import "./chunk-L227SKTB.js";
|
|
492
507
|
import {
|
|
493
508
|
importCapsule
|
|
494
|
-
} from "./chunk-
|
|
509
|
+
} from "./chunk-DHGSZ3UD.js";
|
|
495
510
|
import "./chunk-BT7NVCML.js";
|
|
496
511
|
import "./chunk-H7XKCNR6.js";
|
|
497
512
|
import {
|
|
@@ -501,18 +516,22 @@ import {
|
|
|
501
516
|
renderXrayJson,
|
|
502
517
|
renderXrayMarkdown,
|
|
503
518
|
renderXrayText
|
|
504
|
-
} from "./chunk-
|
|
519
|
+
} from "./chunk-3C5RPJAX.js";
|
|
505
520
|
import "./chunk-SOBJ6NEY.js";
|
|
506
521
|
import {
|
|
522
|
+
branchNamespaceName,
|
|
523
|
+
describeCodingScope,
|
|
507
524
|
normalizeOriginUrl,
|
|
525
|
+
projectNamespaceName,
|
|
526
|
+
resolveCodingNamespaceOverlay,
|
|
508
527
|
resolveGitContext,
|
|
509
528
|
stableHash
|
|
510
|
-
} from "./chunk-
|
|
529
|
+
} from "./chunk-EDQVAMQI.js";
|
|
511
530
|
import {
|
|
512
531
|
isTrustZoneName
|
|
513
|
-
} from "./chunk-
|
|
514
|
-
import "./chunk-
|
|
515
|
-
import "./chunk-
|
|
532
|
+
} from "./chunk-472U7RDF.js";
|
|
533
|
+
import "./chunk-7Q3RCKAQ.js";
|
|
534
|
+
import "./chunk-WSGF57U2.js";
|
|
516
535
|
import {
|
|
517
536
|
isLcmMessagePartKind,
|
|
518
537
|
normalizeExplicitParts,
|
|
@@ -522,30 +541,29 @@ import {
|
|
|
522
541
|
parseOpenClawMessageParts,
|
|
523
542
|
parsePiMessageParts,
|
|
524
543
|
partsFromRenderedText
|
|
525
|
-
} from "./chunk-
|
|
526
|
-
import "./chunk-
|
|
527
|
-
import "./chunk-
|
|
544
|
+
} from "./chunk-XKIQZXUB.js";
|
|
545
|
+
import "./chunk-UEY3VB6W.js";
|
|
546
|
+
import "./chunk-2AN2L4NL.js";
|
|
528
547
|
import {
|
|
529
548
|
memoryWorthOutcomeEligibleCategories,
|
|
530
549
|
recordMemoryOutcome
|
|
531
550
|
} from "./chunk-EIR5VLIH.js";
|
|
532
|
-
import "./chunk-
|
|
533
|
-
import "./chunk-
|
|
534
|
-
import "./chunk-
|
|
551
|
+
import "./chunk-JKV57BTN.js";
|
|
552
|
+
import "./chunk-EI6V5UXY.js";
|
|
553
|
+
import "./chunk-QY7YA7OL.js";
|
|
535
554
|
import "./chunk-NNVTUXEB.js";
|
|
536
555
|
import {
|
|
537
556
|
buildProcedureMarkdownBody,
|
|
538
557
|
parseProcedureStepsFromBody
|
|
539
558
|
} from "./chunk-QDW3E4RD.js";
|
|
540
|
-
import "./chunk-
|
|
559
|
+
import "./chunk-EUML3N6B.js";
|
|
541
560
|
import {
|
|
542
561
|
CrossNamespaceBudget,
|
|
543
562
|
DEFAULT_CROSS_NAMESPACE_BUDGET
|
|
544
|
-
} from "./chunk-
|
|
545
|
-
import "./chunk-
|
|
546
|
-
import "./chunk-RK2Y4XOM.js";
|
|
563
|
+
} from "./chunk-CHCA44C3.js";
|
|
564
|
+
import "./chunk-4JRRISLU.js";
|
|
547
565
|
import "./chunk-2LSZVONP.js";
|
|
548
|
-
import "./chunk-
|
|
566
|
+
import "./chunk-DEUNUKTD.js";
|
|
549
567
|
import {
|
|
550
568
|
BRIEFING_FORMAT_ALLOWED,
|
|
551
569
|
FileCalendarSource,
|
|
@@ -558,12 +576,12 @@ import {
|
|
|
558
576
|
renderBriefingMarkdown,
|
|
559
577
|
resolveBriefingSaveDir,
|
|
560
578
|
validateBriefingFormat
|
|
561
|
-
} from "./chunk-
|
|
579
|
+
} from "./chunk-YHV3KRKS.js";
|
|
562
580
|
import {
|
|
563
581
|
StorageManager,
|
|
564
582
|
parseEntityFile,
|
|
565
583
|
serializeEntityFile
|
|
566
|
-
} from "./chunk-
|
|
584
|
+
} from "./chunk-UIPDNLXA.js";
|
|
567
585
|
import "./chunk-5UZXUTVO.js";
|
|
568
586
|
import {
|
|
569
587
|
CITATION_UNKNOWN,
|
|
@@ -575,19 +593,19 @@ import {
|
|
|
575
593
|
parseAllCitations,
|
|
576
594
|
parseCitation,
|
|
577
595
|
stripCitation
|
|
578
|
-
} from "./chunk-
|
|
596
|
+
} from "./chunk-4H5ZJHEN.js";
|
|
579
597
|
import {
|
|
580
598
|
DEFAULT_RECALL_DISCLOSURE,
|
|
581
599
|
RECALL_DISCLOSURE_LEVELS,
|
|
582
600
|
isRecallDisclosure
|
|
583
|
-
} from "./chunk-
|
|
601
|
+
} from "./chunk-M5T4Q2ZU.js";
|
|
584
602
|
import {
|
|
585
603
|
normalizeProjectionPreview,
|
|
586
604
|
normalizeProjectionTags
|
|
587
605
|
} from "./chunk-SCU65EZI.js";
|
|
588
|
-
import "./chunk-
|
|
606
|
+
import "./chunk-KILOTVIF.js";
|
|
589
607
|
import "./chunk-3HPAPHUK.js";
|
|
590
|
-
import "./chunk-
|
|
608
|
+
import "./chunk-CPPS65WS.js";
|
|
591
609
|
import "./chunk-RULE4VG5.js";
|
|
592
610
|
import "./chunk-DM2T26WE.js";
|
|
593
611
|
import "./chunk-QSVPYQPG.js";
|
|
@@ -599,27 +617,28 @@ import {
|
|
|
599
617
|
getVersion,
|
|
600
618
|
listVersions,
|
|
601
619
|
revertToVersion
|
|
602
|
-
} from "./chunk-
|
|
603
|
-
import {
|
|
604
|
-
expandTildePath
|
|
605
|
-
} from "./chunk-QRNI5JBH.js";
|
|
620
|
+
} from "./chunk-ALEPI75L.js";
|
|
606
621
|
import "./chunk-ZY2MNJR6.js";
|
|
607
|
-
import "./chunk-
|
|
622
|
+
import "./chunk-LMPHTYJC.js";
|
|
608
623
|
import "./chunk-DT5TVLJE.js";
|
|
609
624
|
import {
|
|
610
625
|
resolvePrincipal
|
|
611
|
-
} from "./chunk-
|
|
626
|
+
} from "./chunk-HWVTS5NO.js";
|
|
627
|
+
import "./chunk-U3PN77QT.js";
|
|
612
628
|
import "./chunk-4DJQYKMN.js";
|
|
629
|
+
import {
|
|
630
|
+
expandTildePath
|
|
631
|
+
} from "./chunk-EYIEWJNI.js";
|
|
613
632
|
import {
|
|
614
633
|
readEnvVar,
|
|
615
634
|
resolveHomeDir
|
|
616
|
-
} from "./chunk-
|
|
635
|
+
} from "./chunk-JUC24CTX.js";
|
|
617
636
|
import "./chunk-TBBDFYXW.js";
|
|
618
637
|
import {
|
|
619
638
|
initLogger,
|
|
620
639
|
log
|
|
621
640
|
} from "./chunk-2ODBA7MQ.js";
|
|
622
|
-
import "./chunk-
|
|
641
|
+
import "./chunk-A2IYSXDQ.js";
|
|
623
642
|
import "./chunk-LPSF4OQH.js";
|
|
624
643
|
import {
|
|
625
644
|
AccessAuditAdapter
|
|
@@ -630,7 +649,7 @@ import {
|
|
|
630
649
|
normalizeQueryText
|
|
631
650
|
} from "./chunk-RFYAYKTD.js";
|
|
632
651
|
import "./chunk-LBLXEFWK.js";
|
|
633
|
-
import "./chunk-
|
|
652
|
+
import "./chunk-VFUEZZBS.js";
|
|
634
653
|
import {
|
|
635
654
|
formatZodError,
|
|
636
655
|
memoryStoreRequestSchema,
|
|
@@ -638,13 +657,13 @@ import {
|
|
|
638
657
|
recallRequestSchema,
|
|
639
658
|
suggestionSubmitRequestSchema,
|
|
640
659
|
validateRequest
|
|
641
|
-
} from "./chunk-
|
|
642
|
-
import "./chunk-
|
|
660
|
+
} from "./chunk-5UHVGNZD.js";
|
|
661
|
+
import "./chunk-IPLYGWQF.js";
|
|
662
|
+
import "./chunk-J4EB7DNW.js";
|
|
643
663
|
import {
|
|
644
664
|
CAPSULE_ID_PATTERN
|
|
645
665
|
} from "./chunk-WEHSQBFR.js";
|
|
646
|
-
import "./chunk-
|
|
647
|
-
import "./chunk-J4EB7DNW.js";
|
|
666
|
+
import "./chunk-X7Y7WX73.js";
|
|
648
667
|
import "./chunk-BJMBJZ2Y.js";
|
|
649
668
|
import "./chunk-UKJAGEXH.js";
|
|
650
669
|
import "./chunk-FP2373TW.js";
|
|
@@ -677,13 +696,13 @@ import {
|
|
|
677
696
|
summarizeOfflineSyncPendingChanges,
|
|
678
697
|
summarizeOfflineSyncPendingFiles,
|
|
679
698
|
writeOfflineSyncState
|
|
680
|
-
} from "./chunk-
|
|
681
|
-
import "./chunk-
|
|
699
|
+
} from "./chunk-ZEY4KYRQ.js";
|
|
700
|
+
import "./chunk-UI3NYK34.js";
|
|
682
701
|
import {
|
|
683
702
|
assertIsDirectoryNotSymlink,
|
|
684
703
|
assertRealpathInsideRoot
|
|
685
|
-
} from "./chunk-
|
|
686
|
-
import "./chunk-
|
|
704
|
+
} from "./chunk-GCGJW34D.js";
|
|
705
|
+
import "./chunk-KJMYHC7K.js";
|
|
687
706
|
import "./chunk-A6XUJE5D.js";
|
|
688
707
|
import {
|
|
689
708
|
parseFlexibleIsoTimestamp,
|
|
@@ -814,13 +833,80 @@ function splitDiffGitPaths(rest) {
|
|
|
814
833
|
function stripDiffPathPrefix(raw) {
|
|
815
834
|
let s = raw;
|
|
816
835
|
if (s.length >= 2 && s[0] === '"' && s[s.length - 1] === '"') {
|
|
817
|
-
|
|
818
|
-
|
|
836
|
+
const decoded = decodeGitCQuotedPath(s.slice(1, -1));
|
|
837
|
+
if (decoded === null) {
|
|
838
|
+
return raw;
|
|
839
|
+
}
|
|
840
|
+
s = decoded;
|
|
819
841
|
}
|
|
820
842
|
s = s.replace(/\\/g, "/");
|
|
821
843
|
if (s.startsWith("a/") || s.startsWith("b/")) s = s.slice(2);
|
|
822
844
|
return s;
|
|
823
845
|
}
|
|
846
|
+
function decodeGitCQuotedPath(value) {
|
|
847
|
+
const bytes = [];
|
|
848
|
+
const encoder = new TextEncoder();
|
|
849
|
+
const appendText = (text) => {
|
|
850
|
+
bytes.push(...encoder.encode(text));
|
|
851
|
+
};
|
|
852
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
853
|
+
const char = value[index];
|
|
854
|
+
if (char !== "\\") {
|
|
855
|
+
appendText(char);
|
|
856
|
+
continue;
|
|
857
|
+
}
|
|
858
|
+
if (index + 1 >= value.length) {
|
|
859
|
+
appendText("\\");
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
const next = value[index + 1];
|
|
863
|
+
if (next >= "0" && next <= "7") {
|
|
864
|
+
let octal = next;
|
|
865
|
+
let cursor = index + 2;
|
|
866
|
+
while (cursor < value.length && octal.length < 3) {
|
|
867
|
+
const digit = value[cursor];
|
|
868
|
+
if (digit < "0" || digit > "7") break;
|
|
869
|
+
octal += digit;
|
|
870
|
+
cursor += 1;
|
|
871
|
+
}
|
|
872
|
+
bytes.push(Number.parseInt(octal, 8));
|
|
873
|
+
index = cursor - 1;
|
|
874
|
+
continue;
|
|
875
|
+
}
|
|
876
|
+
const escaped = cEscapeValue(next);
|
|
877
|
+
if (escaped !== null) {
|
|
878
|
+
appendText(escaped);
|
|
879
|
+
index += 1;
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
appendText(`\\${next}`);
|
|
883
|
+
index += 1;
|
|
884
|
+
}
|
|
885
|
+
try {
|
|
886
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(Uint8Array.from(bytes));
|
|
887
|
+
} catch {
|
|
888
|
+
return null;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
function cEscapeValue(value) {
|
|
892
|
+
switch (value) {
|
|
893
|
+
case "n":
|
|
894
|
+
return "\n";
|
|
895
|
+
case "t":
|
|
896
|
+
return " ";
|
|
897
|
+
case "r":
|
|
898
|
+
return "\r";
|
|
899
|
+
case "b":
|
|
900
|
+
return "\b";
|
|
901
|
+
case "f":
|
|
902
|
+
return "\f";
|
|
903
|
+
case "\\":
|
|
904
|
+
case '"':
|
|
905
|
+
return value;
|
|
906
|
+
default:
|
|
907
|
+
return null;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
824
910
|
var BOOST_PER_MATCH = 0.5;
|
|
825
911
|
var MAX_BOOST = 1;
|
|
826
912
|
function countPathHits(entityRefs, touchedFiles) {
|
|
@@ -891,17 +977,28 @@ var FilesystemBackend = class {
|
|
|
891
977
|
if (!basePath || basePath.trim().length === 0) {
|
|
892
978
|
throw new Error("FilesystemBackend requires a non-empty basePath");
|
|
893
979
|
}
|
|
894
|
-
this.basePath = basePath;
|
|
980
|
+
this.basePath = path.resolve(basePath);
|
|
981
|
+
}
|
|
982
|
+
resolveRemotePath(remotePath) {
|
|
983
|
+
if (path.isAbsolute(remotePath)) {
|
|
984
|
+
throw new Error(`FilesystemBackend remotePath must be relative: ${JSON.stringify(remotePath)}`);
|
|
985
|
+
}
|
|
986
|
+
const resolved = path.resolve(this.basePath, remotePath);
|
|
987
|
+
const relative = path.relative(this.basePath, resolved);
|
|
988
|
+
if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
|
989
|
+
throw new Error(`FilesystemBackend remotePath escapes basePath: ${JSON.stringify(remotePath)}`);
|
|
990
|
+
}
|
|
991
|
+
return resolved;
|
|
895
992
|
}
|
|
896
993
|
async upload(localPath, remotePath) {
|
|
897
|
-
const dest =
|
|
994
|
+
const dest = this.resolveRemotePath(remotePath);
|
|
898
995
|
const destDir = path.dirname(dest);
|
|
899
996
|
await fsp.mkdir(destDir, { recursive: true });
|
|
900
997
|
await fsp.copyFile(localPath, dest);
|
|
901
998
|
return dest;
|
|
902
999
|
}
|
|
903
1000
|
async exists(remotePath) {
|
|
904
|
-
const dest =
|
|
1001
|
+
const dest = this.resolveRemotePath(remotePath);
|
|
905
1002
|
try {
|
|
906
1003
|
await fsp.access(dest, fs.constants.F_OK);
|
|
907
1004
|
return true;
|
|
@@ -910,7 +1007,7 @@ var FilesystemBackend = class {
|
|
|
910
1007
|
}
|
|
911
1008
|
}
|
|
912
1009
|
async delete(remotePath) {
|
|
913
|
-
const dest =
|
|
1010
|
+
const dest = this.resolveRemotePath(remotePath);
|
|
914
1011
|
try {
|
|
915
1012
|
await fsp.unlink(dest);
|
|
916
1013
|
} catch (err) {
|
|
@@ -951,6 +1048,7 @@ function createBackend(cfg) {
|
|
|
951
1048
|
// src/binary-lifecycle/scanner.ts
|
|
952
1049
|
import fsp2 from "fs/promises";
|
|
953
1050
|
import path2 from "path";
|
|
1051
|
+
import crypto from "crypto";
|
|
954
1052
|
function matchesPatterns(filename, patterns) {
|
|
955
1053
|
const lower = filename.toLowerCase();
|
|
956
1054
|
for (const pattern of patterns) {
|
|
@@ -964,7 +1062,7 @@ function matchesPatterns(filename, patterns) {
|
|
|
964
1062
|
return false;
|
|
965
1063
|
}
|
|
966
1064
|
async function scanForBinaries(memoryDir, config, manifest) {
|
|
967
|
-
const tracked = new
|
|
1065
|
+
const tracked = new Map(manifest.assets.map((a) => [a.originalPath, a]));
|
|
968
1066
|
const results = [];
|
|
969
1067
|
async function walk(dir) {
|
|
970
1068
|
let entries;
|
|
@@ -983,11 +1081,22 @@ async function scanForBinaries(memoryDir, config, manifest) {
|
|
|
983
1081
|
}
|
|
984
1082
|
if (!entry.isFile()) continue;
|
|
985
1083
|
if (!matchesPatterns(entry.name, config.scanPatterns)) continue;
|
|
986
|
-
if (tracked.has(relativePath)) continue;
|
|
987
1084
|
try {
|
|
988
1085
|
const stat = await fsp2.stat(fullPath);
|
|
989
1086
|
if (stat.size > config.maxBinarySizeBytes) continue;
|
|
990
1087
|
if (stat.size === 0) continue;
|
|
1088
|
+
const existing = tracked.get(relativePath);
|
|
1089
|
+
if (existing) {
|
|
1090
|
+
if (existing.sizeBytes !== stat.size) {
|
|
1091
|
+
results.push(relativePath);
|
|
1092
|
+
continue;
|
|
1093
|
+
}
|
|
1094
|
+
const contentHash = await hashFile(fullPath);
|
|
1095
|
+
if (existing.contentHash !== contentHash) {
|
|
1096
|
+
results.push(relativePath);
|
|
1097
|
+
}
|
|
1098
|
+
continue;
|
|
1099
|
+
}
|
|
991
1100
|
} catch {
|
|
992
1101
|
continue;
|
|
993
1102
|
}
|
|
@@ -997,11 +1106,15 @@ async function scanForBinaries(memoryDir, config, manifest) {
|
|
|
997
1106
|
await walk(memoryDir);
|
|
998
1107
|
return results;
|
|
999
1108
|
}
|
|
1109
|
+
async function hashFile(filePath) {
|
|
1110
|
+
const content = await fsp2.readFile(filePath);
|
|
1111
|
+
return crypto.createHash("sha256").update(content).digest("hex");
|
|
1112
|
+
}
|
|
1000
1113
|
|
|
1001
1114
|
// src/binary-lifecycle/manifest.ts
|
|
1002
1115
|
import fsp3 from "fs/promises";
|
|
1003
1116
|
import path3 from "path";
|
|
1004
|
-
import
|
|
1117
|
+
import crypto2 from "crypto";
|
|
1005
1118
|
var MANIFEST_DIR = ".binary-lifecycle";
|
|
1006
1119
|
var MANIFEST_FILE = "manifest.json";
|
|
1007
1120
|
function manifestDir(memoryDir) {
|
|
@@ -1031,7 +1144,7 @@ async function writeManifest(memoryDir, manifest) {
|
|
|
1031
1144
|
const dir = manifestDir(memoryDir);
|
|
1032
1145
|
await fsp3.mkdir(dir, { recursive: true });
|
|
1033
1146
|
const dest = manifestPath(memoryDir);
|
|
1034
|
-
const tmpSuffix =
|
|
1147
|
+
const tmpSuffix = crypto2.randomBytes(8).toString("hex");
|
|
1035
1148
|
const tmpPath = `${dest}.${tmpSuffix}.tmp`;
|
|
1036
1149
|
const content = JSON.stringify(manifest, null, 2) + "\n";
|
|
1037
1150
|
await fsp3.writeFile(tmpPath, content, "utf-8");
|
|
@@ -1052,10 +1165,10 @@ function emptyManifest() {
|
|
|
1052
1165
|
// src/binary-lifecycle/pipeline.ts
|
|
1053
1166
|
import fsp4 from "fs/promises";
|
|
1054
1167
|
import path4 from "path";
|
|
1055
|
-
import
|
|
1056
|
-
async function
|
|
1168
|
+
import crypto3 from "crypto";
|
|
1169
|
+
async function hashFile2(filePath) {
|
|
1057
1170
|
const content = await fsp4.readFile(filePath);
|
|
1058
|
-
return
|
|
1171
|
+
return crypto3.createHash("sha256").update(content).digest("hex");
|
|
1059
1172
|
}
|
|
1060
1173
|
function guessMimeType(ext) {
|
|
1061
1174
|
const map = {
|
|
@@ -1073,6 +1186,11 @@ function guessMimeType(ext) {
|
|
|
1073
1186
|
function escapeRegex(s) {
|
|
1074
1187
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1075
1188
|
}
|
|
1189
|
+
function validateBinaryLifecycleConfig(config) {
|
|
1190
|
+
if (typeof config.gracePeriodDays !== "number" || !Number.isFinite(config.gracePeriodDays) || !Number.isInteger(config.gracePeriodDays) || config.gracePeriodDays < 0) {
|
|
1191
|
+
throw new Error("binary lifecycle gracePeriodDays must be a finite non-negative integer");
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1076
1194
|
async function stageMirror(memoryDir, newPaths, backend, assets, log2, dryRun) {
|
|
1077
1195
|
let mirrored = 0;
|
|
1078
1196
|
const errors = [];
|
|
@@ -1080,7 +1198,7 @@ async function stageMirror(memoryDir, newPaths, backend, assets, log2, dryRun) {
|
|
|
1080
1198
|
const fullPath = path4.join(memoryDir, relPath);
|
|
1081
1199
|
try {
|
|
1082
1200
|
const stat = await fsp4.stat(fullPath);
|
|
1083
|
-
const contentHash = await
|
|
1201
|
+
const contentHash = await hashFile2(fullPath);
|
|
1084
1202
|
const ext = path4.extname(relPath);
|
|
1085
1203
|
const mimeType = guessMimeType(ext);
|
|
1086
1204
|
const remotePath = relPath;
|
|
@@ -1097,7 +1215,13 @@ async function stageMirror(memoryDir, newPaths, backend, assets, log2, dryRun) {
|
|
|
1097
1215
|
mirroredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1098
1216
|
status: "mirrored"
|
|
1099
1217
|
};
|
|
1100
|
-
|
|
1218
|
+
if (!dryRun) {
|
|
1219
|
+
const existingIndex = assets.findIndex((asset) => asset.originalPath === relPath);
|
|
1220
|
+
if (existingIndex >= 0) {
|
|
1221
|
+
assets.splice(existingIndex, 1);
|
|
1222
|
+
}
|
|
1223
|
+
assets.push(record);
|
|
1224
|
+
}
|
|
1101
1225
|
mirrored++;
|
|
1102
1226
|
log2.info(`[binary-lifecycle] mirrored: ${relPath} (${stat.size} bytes)${dryRun ? " [dry-run]" : ""}`);
|
|
1103
1227
|
} catch (err) {
|
|
@@ -1146,14 +1270,18 @@ async function stageRedirect(memoryDir, assets, log2, dryRun) {
|
|
|
1146
1270
|
}
|
|
1147
1271
|
}
|
|
1148
1272
|
if (matchCount > 0 && writeFailCount === 0) {
|
|
1149
|
-
|
|
1150
|
-
|
|
1273
|
+
if (!dryRun) {
|
|
1274
|
+
asset.status = "redirected";
|
|
1275
|
+
asset.redirectedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1276
|
+
}
|
|
1151
1277
|
redirected++;
|
|
1152
1278
|
log2.info(`[binary-lifecycle] redirected: ${asset.originalPath}${dryRun ? " [dry-run]" : ""}`);
|
|
1153
1279
|
} else if (matchCount > 0 && writeFailCount > 0) {
|
|
1154
|
-
|
|
1280
|
+
if (!dryRun) {
|
|
1281
|
+
asset.status = "error";
|
|
1282
|
+
}
|
|
1155
1283
|
log2.warn(
|
|
1156
|
-
`[binary-lifecycle] redirect partial failure for ${asset.originalPath}: ${matchCount} match(es), ${writeFailCount} write failure(s) \u2014 status set to error`
|
|
1284
|
+
`[binary-lifecycle] redirect partial failure for ${asset.originalPath}: ${matchCount} match(es), ${writeFailCount} write failure(s)${dryRun ? "" : " \u2014 status set to error"}`
|
|
1157
1285
|
);
|
|
1158
1286
|
}
|
|
1159
1287
|
}
|
|
@@ -1175,11 +1303,18 @@ async function stageClean(memoryDir, assets, gracePeriodDays, log2, dryRun, forc
|
|
|
1175
1303
|
}
|
|
1176
1304
|
const fullPath = path4.join(memoryDir, asset.originalPath);
|
|
1177
1305
|
try {
|
|
1306
|
+
const currentHash = await hashFile2(fullPath);
|
|
1307
|
+
if (currentHash !== asset.contentHash) {
|
|
1308
|
+
const msg = `clean blocked for ${asset.originalPath}: local content hash does not match manifest`;
|
|
1309
|
+
log2.warn(`[binary-lifecycle] ${msg}`);
|
|
1310
|
+
errors.push(msg);
|
|
1311
|
+
continue;
|
|
1312
|
+
}
|
|
1178
1313
|
if (!dryRun) {
|
|
1179
1314
|
await fsp4.unlink(fullPath);
|
|
1315
|
+
asset.status = "cleaned";
|
|
1316
|
+
asset.cleanedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1180
1317
|
}
|
|
1181
|
-
asset.status = "cleaned";
|
|
1182
|
-
asset.cleanedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1183
1318
|
cleaned++;
|
|
1184
1319
|
log2.info(`[binary-lifecycle] cleaned: ${asset.originalPath}${dryRun ? " [dry-run]" : ""}`);
|
|
1185
1320
|
} catch (err) {
|
|
@@ -1219,8 +1354,19 @@ async function findMarkdownFiles(dir) {
|
|
|
1219
1354
|
return results;
|
|
1220
1355
|
}
|
|
1221
1356
|
async function runBinaryLifecyclePipeline(memoryDir, config, backend, log2, opts) {
|
|
1357
|
+
validateBinaryLifecycleConfig(config);
|
|
1222
1358
|
const dryRun = opts?.dryRun ?? false;
|
|
1223
1359
|
const forceClean = opts?.forceClean ?? false;
|
|
1360
|
+
if (config.enabled === false) {
|
|
1361
|
+
return {
|
|
1362
|
+
scanned: 0,
|
|
1363
|
+
mirrored: 0,
|
|
1364
|
+
redirected: 0,
|
|
1365
|
+
cleaned: 0,
|
|
1366
|
+
errors: [],
|
|
1367
|
+
dryRun
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1224
1370
|
const manifest = await readManifest(memoryDir);
|
|
1225
1371
|
const newPaths = await scanForBinaries(memoryDir, config, manifest);
|
|
1226
1372
|
const scanned = newPaths.length;
|
|
@@ -1262,38 +1408,8 @@ async function runBinaryLifecyclePipeline(memoryDir, config, backend, log2, opts
|
|
|
1262
1408
|
|
|
1263
1409
|
// src/projection/index.ts
|
|
1264
1410
|
import fs2 from "fs";
|
|
1265
|
-
import path6 from "path";
|
|
1266
|
-
|
|
1267
|
-
// src/utils/category-dir.ts
|
|
1268
1411
|
import path5 from "path";
|
|
1269
|
-
var
|
|
1270
|
-
correction: "corrections",
|
|
1271
|
-
question: "questions",
|
|
1272
|
-
preference: "preferences",
|
|
1273
|
-
decision: "decisions",
|
|
1274
|
-
moment: "moments",
|
|
1275
|
-
commitment: "commitments",
|
|
1276
|
-
principle: "principles",
|
|
1277
|
-
rule: "rules",
|
|
1278
|
-
skill: "skills",
|
|
1279
|
-
relationship: "relationships",
|
|
1280
|
-
procedure: "procedures",
|
|
1281
|
-
reasoning_trace: "reasoning-traces"
|
|
1282
|
-
};
|
|
1283
|
-
var ALL_CATEGORY_DIRS = [
|
|
1284
|
-
"facts",
|
|
1285
|
-
...Object.values(CATEGORY_DIR_MAP)
|
|
1286
|
-
];
|
|
1287
|
-
var ALL_CATEGORY_KEYS = [
|
|
1288
|
-
"fact",
|
|
1289
|
-
...Object.keys(CATEGORY_DIR_MAP)
|
|
1290
|
-
];
|
|
1291
|
-
function getCategoryDir(memoryDir, category) {
|
|
1292
|
-
const dir = CATEGORY_DIR_MAP[category];
|
|
1293
|
-
return dir ? path5.join(memoryDir, dir) : path5.join(memoryDir, "facts");
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
// src/projection/index.ts
|
|
1412
|
+
var VALID_PROJECTION_CATEGORIES = new Set(ALL_CATEGORY_KEYS);
|
|
1297
1413
|
async function generateContextTree(options) {
|
|
1298
1414
|
const startTime = Date.now();
|
|
1299
1415
|
const {
|
|
@@ -1307,13 +1423,20 @@ async function generateContextTree(options) {
|
|
|
1307
1423
|
let nodesGenerated = 0;
|
|
1308
1424
|
let nodesSkipped = 0;
|
|
1309
1425
|
const categoryCounts = {};
|
|
1310
|
-
|
|
1311
|
-
const
|
|
1426
|
+
const resolvedMemoryDir = path5.resolve(memoryDir);
|
|
1427
|
+
const resolvedOutputDir = path5.resolve(outputDir);
|
|
1428
|
+
const requestedCategories = validateProjectionCategories(filterCategories);
|
|
1429
|
+
const realMemoryDir = fs2.realpathSync(resolvedMemoryDir);
|
|
1430
|
+
assertNotSymlink(resolvedOutputDir, "context tree outputDir");
|
|
1431
|
+
fs2.mkdirSync(resolvedOutputDir, { recursive: true });
|
|
1432
|
+
const realOutputDir = fs2.realpathSync(resolvedOutputDir);
|
|
1433
|
+
const allCategories = (requestedCategories ?? ALL_CATEGORY_KEYS).filter((c) => c !== "question");
|
|
1312
1434
|
for (const category of allCategories) {
|
|
1313
1435
|
const categoryDir = getCategoryDir(memoryDir, category);
|
|
1314
1436
|
if (!fs2.existsSync(categoryDir)) continue;
|
|
1437
|
+
assertSafeInputRoot(realMemoryDir, categoryDir, `${category} memory category`);
|
|
1315
1438
|
categoryCounts[category] = 0;
|
|
1316
|
-
const files = walkR(categoryDir);
|
|
1439
|
+
const files = walkR(categoryDir, realMemoryDir);
|
|
1317
1440
|
let count = 0;
|
|
1318
1441
|
for (const filePath of files) {
|
|
1319
1442
|
if (count >= maxPerCategory) {
|
|
@@ -1331,19 +1454,19 @@ async function generateContextTree(options) {
|
|
|
1331
1454
|
nodesSkipped++;
|
|
1332
1455
|
continue;
|
|
1333
1456
|
}
|
|
1334
|
-
const outputPath =
|
|
1335
|
-
|
|
1336
|
-
fs2.writeFileSync(outputPath, node.content);
|
|
1457
|
+
const outputPath = resolveContainedOutputPath(realOutputDir, node.path);
|
|
1458
|
+
writeProjectedContent(realOutputDir, outputPath, node.content);
|
|
1337
1459
|
nodesGenerated++;
|
|
1338
1460
|
categoryCounts[category] = (categoryCounts[category] ?? 0) + 1;
|
|
1339
1461
|
count++;
|
|
1340
1462
|
}
|
|
1341
1463
|
}
|
|
1342
1464
|
if (includeEntities) {
|
|
1343
|
-
const entitiesDir =
|
|
1465
|
+
const entitiesDir = path5.join(memoryDir, "entities");
|
|
1344
1466
|
if (fs2.existsSync(entitiesDir)) {
|
|
1467
|
+
assertSafeInputRoot(realMemoryDir, entitiesDir, "entities root");
|
|
1345
1468
|
categoryCounts["entity"] = 0;
|
|
1346
|
-
const entityFiles = walkR(entitiesDir);
|
|
1469
|
+
const entityFiles = walkR(entitiesDir, realMemoryDir);
|
|
1347
1470
|
let count = 0;
|
|
1348
1471
|
for (const filePath of entityFiles) {
|
|
1349
1472
|
if (count >= maxPerCategory) {
|
|
@@ -1351,22 +1474,23 @@ async function generateContextTree(options) {
|
|
|
1351
1474
|
continue;
|
|
1352
1475
|
}
|
|
1353
1476
|
const content = fs2.readFileSync(filePath, "utf8");
|
|
1354
|
-
const fileName =
|
|
1477
|
+
const fileName = path5.basename(filePath, ".md");
|
|
1355
1478
|
const node = projectEntityNode(fileName, content);
|
|
1356
|
-
const outputPath =
|
|
1357
|
-
|
|
1358
|
-
fs2.writeFileSync(outputPath, node.content);
|
|
1479
|
+
const outputPath = resolveContainedOutputPath(realOutputDir, "entities", `${fileName}.md`);
|
|
1480
|
+
writeProjectedContent(realOutputDir, outputPath, node.content);
|
|
1359
1481
|
nodesGenerated++;
|
|
1360
1482
|
categoryCounts["entity"] = (categoryCounts["entity"] ?? 0) + 1;
|
|
1361
1483
|
count++;
|
|
1362
1484
|
}
|
|
1363
1485
|
}
|
|
1364
1486
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1487
|
+
const shouldIncludeQuestions = includeQuestions && (requestedCategories === void 0 || requestedCategories.includes("question"));
|
|
1488
|
+
if (shouldIncludeQuestions) {
|
|
1489
|
+
const questionsDir = path5.join(memoryDir, "questions");
|
|
1367
1490
|
if (fs2.existsSync(questionsDir)) {
|
|
1491
|
+
assertSafeInputRoot(realMemoryDir, questionsDir, "questions root");
|
|
1368
1492
|
categoryCounts["question"] = 0;
|
|
1369
|
-
const qFiles = walkR(questionsDir);
|
|
1493
|
+
const qFiles = walkR(questionsDir, realMemoryDir);
|
|
1370
1494
|
let count = 0;
|
|
1371
1495
|
for (const filePath of qFiles) {
|
|
1372
1496
|
if (count >= maxPerCategory) {
|
|
@@ -1384,17 +1508,16 @@ async function generateContextTree(options) {
|
|
|
1384
1508
|
nodesSkipped++;
|
|
1385
1509
|
continue;
|
|
1386
1510
|
}
|
|
1387
|
-
const outputPath =
|
|
1388
|
-
|
|
1389
|
-
fs2.writeFileSync(outputPath, node.content);
|
|
1511
|
+
const outputPath = resolveContainedOutputPath(realOutputDir, node.path);
|
|
1512
|
+
writeProjectedContent(realOutputDir, outputPath, node.content);
|
|
1390
1513
|
nodesGenerated++;
|
|
1391
1514
|
categoryCounts["question"] = (categoryCounts["question"] ?? 0) + 1;
|
|
1392
1515
|
count++;
|
|
1393
1516
|
}
|
|
1394
1517
|
}
|
|
1395
1518
|
}
|
|
1396
|
-
const index = generateIndex(categoryCounts,
|
|
1397
|
-
|
|
1519
|
+
const index = generateIndex(categoryCounts, resolvedOutputDir);
|
|
1520
|
+
writeProjectedContent(realOutputDir, resolveContainedOutputPath(realOutputDir, "INDEX.md"), index);
|
|
1398
1521
|
return {
|
|
1399
1522
|
nodesGenerated,
|
|
1400
1523
|
nodesSkipped,
|
|
@@ -1403,14 +1526,134 @@ async function generateContextTree(options) {
|
|
|
1403
1526
|
outputDir
|
|
1404
1527
|
};
|
|
1405
1528
|
}
|
|
1406
|
-
function
|
|
1529
|
+
function isPathInside(root, candidate) {
|
|
1530
|
+
const relative = path5.relative(root, candidate);
|
|
1531
|
+
return relative === "" || !relative.startsWith("..") && !path5.isAbsolute(relative);
|
|
1532
|
+
}
|
|
1533
|
+
function assertNotSymlink(targetPath, label) {
|
|
1534
|
+
try {
|
|
1535
|
+
if (fs2.lstatSync(targetPath).isSymbolicLink()) {
|
|
1536
|
+
throw new Error(`${label} must not be a symlink: ${targetPath}`);
|
|
1537
|
+
}
|
|
1538
|
+
} catch (err) {
|
|
1539
|
+
if (err.code === "ENOENT") return;
|
|
1540
|
+
throw err;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
function assertSafeInputRoot(realMemoryDir, targetPath, label) {
|
|
1544
|
+
const stat = fs2.lstatSync(targetPath);
|
|
1545
|
+
if (stat.isSymbolicLink()) {
|
|
1546
|
+
throw new Error(`${label} must not be a symlink: ${targetPath}`);
|
|
1547
|
+
}
|
|
1548
|
+
if (!stat.isDirectory()) {
|
|
1549
|
+
throw new Error(`${label} must be a directory: ${targetPath}`);
|
|
1550
|
+
}
|
|
1551
|
+
const realTarget = fs2.realpathSync(targetPath);
|
|
1552
|
+
if (!isPathInside(realMemoryDir, realTarget)) {
|
|
1553
|
+
throw new Error(`${label} escapes memoryDir: ${targetPath}`);
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
function assertSafeOutputTarget(realOutputDir, outputPath) {
|
|
1557
|
+
let current = realOutputDir;
|
|
1558
|
+
const relative = path5.relative(realOutputDir, outputPath);
|
|
1559
|
+
if (relative.startsWith("..") || path5.isAbsolute(relative)) {
|
|
1560
|
+
throw new Error(`context tree output path escapes outputDir: ${outputPath}`);
|
|
1561
|
+
}
|
|
1562
|
+
for (const segment of relative.split(path5.sep).filter(Boolean)) {
|
|
1563
|
+
current = path5.join(current, segment);
|
|
1564
|
+
try {
|
|
1565
|
+
const stat = fs2.lstatSync(current);
|
|
1566
|
+
if (stat.isSymbolicLink()) {
|
|
1567
|
+
throw new Error(`context tree output path contains symlink: ${current}`);
|
|
1568
|
+
}
|
|
1569
|
+
} catch (err) {
|
|
1570
|
+
if (err.code === "ENOENT") {
|
|
1571
|
+
break;
|
|
1572
|
+
}
|
|
1573
|
+
throw err;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
function validateProjectionCategories(categories) {
|
|
1578
|
+
if (categories === void 0) {
|
|
1579
|
+
return void 0;
|
|
1580
|
+
}
|
|
1581
|
+
const validated = [];
|
|
1582
|
+
for (const category of categories) {
|
|
1583
|
+
if (typeof category !== "string" || !VALID_PROJECTION_CATEGORIES.has(category)) {
|
|
1584
|
+
throw new Error(`invalid context tree category: ${String(category)}`);
|
|
1585
|
+
}
|
|
1586
|
+
if (!validated.includes(category)) {
|
|
1587
|
+
validated.push(category);
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
return validated;
|
|
1591
|
+
}
|
|
1592
|
+
function resolveContainedOutputPath(outputRoot, ...segments) {
|
|
1593
|
+
const resolved = path5.resolve(outputRoot, ...segments);
|
|
1594
|
+
const relative = path5.relative(outputRoot, resolved);
|
|
1595
|
+
if (relative === "" || !relative.startsWith("..") && !path5.isAbsolute(relative)) {
|
|
1596
|
+
return resolved;
|
|
1597
|
+
}
|
|
1598
|
+
throw new Error(`context tree output path escapes outputDir: ${segments.join("/")}`);
|
|
1599
|
+
}
|
|
1600
|
+
function writeProjectedContent(realOutputDir, outputPath, generatedContent) {
|
|
1601
|
+
assertSafeOutputTarget(realOutputDir, outputPath);
|
|
1602
|
+
fs2.mkdirSync(path5.dirname(outputPath), { recursive: true });
|
|
1603
|
+
const realParent = fs2.realpathSync(path5.dirname(outputPath));
|
|
1604
|
+
if (!isPathInside(realOutputDir, realParent)) {
|
|
1605
|
+
throw new Error(`context tree output path escapes outputDir: ${outputPath}`);
|
|
1606
|
+
}
|
|
1607
|
+
const existingContent = fs2.existsSync(outputPath) ? fs2.readFileSync(outputPath, "utf8") : "";
|
|
1608
|
+
fs2.writeFileSync(
|
|
1609
|
+
outputPath,
|
|
1610
|
+
preserveManualFencedBlocks(generatedContent, existingContent)
|
|
1611
|
+
);
|
|
1612
|
+
}
|
|
1613
|
+
function preserveManualFencedBlocks(generatedContent, existingContent) {
|
|
1614
|
+
const manualBlocks = extractManualFencedBlocks(existingContent).filter((block) => !generatedContent.includes(block));
|
|
1615
|
+
if (manualBlocks.length === 0) {
|
|
1616
|
+
return generatedContent;
|
|
1617
|
+
}
|
|
1618
|
+
return `${generatedContent.trimEnd()}
|
|
1619
|
+
|
|
1620
|
+
## Manual Edits
|
|
1621
|
+
|
|
1622
|
+
${manualBlocks.join("\n\n")}
|
|
1623
|
+
`;
|
|
1624
|
+
}
|
|
1625
|
+
function extractManualFencedBlocks(content) {
|
|
1626
|
+
const blocks = [];
|
|
1627
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1628
|
+
const fencePattern = /(?:^|\n)([`~]{3,})[^\n]*\bmanual\b[^\n]*\n[\s\S]*?\n\1[ \t]*(?=\n|$)/gi;
|
|
1629
|
+
for (const match of content.matchAll(fencePattern)) {
|
|
1630
|
+
const block = match[0].trim();
|
|
1631
|
+
if (!seen.has(block)) {
|
|
1632
|
+
seen.add(block);
|
|
1633
|
+
blocks.push(block);
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
return blocks;
|
|
1637
|
+
}
|
|
1638
|
+
function walkR(dir, realMemoryDir) {
|
|
1407
1639
|
const results = [];
|
|
1408
1640
|
function walk(directory) {
|
|
1409
1641
|
for (const entry of fs2.readdirSync(directory, { withFileTypes: true })) {
|
|
1410
|
-
const fullPath =
|
|
1642
|
+
const fullPath = path5.join(directory, entry.name);
|
|
1643
|
+
if (entry.isSymbolicLink()) {
|
|
1644
|
+
throw new Error(`context tree input path contains symlink: ${fullPath}`);
|
|
1645
|
+
}
|
|
1411
1646
|
if (entry.isDirectory()) {
|
|
1647
|
+
const realDir = fs2.realpathSync(fullPath);
|
|
1648
|
+
if (!isPathInside(realMemoryDir, realDir)) {
|
|
1649
|
+
throw new Error(`context tree input path escapes memoryDir: ${fullPath}`);
|
|
1650
|
+
}
|
|
1412
1651
|
walk(fullPath);
|
|
1413
1652
|
} else if (entry.name.endsWith(".md")) {
|
|
1653
|
+
const realFile = fs2.realpathSync(fullPath);
|
|
1654
|
+
if (!isPathInside(realMemoryDir, realFile)) {
|
|
1655
|
+
throw new Error(`context tree input path escapes memoryDir: ${fullPath}`);
|
|
1656
|
+
}
|
|
1414
1657
|
results.push(fullPath);
|
|
1415
1658
|
}
|
|
1416
1659
|
}
|
|
@@ -1449,13 +1692,13 @@ function extractBody(content) {
|
|
|
1449
1692
|
}
|
|
1450
1693
|
function projectNode(filePath, category, fm, rawContent) {
|
|
1451
1694
|
const body = extractBody(rawContent);
|
|
1452
|
-
const fileName =
|
|
1453
|
-
const dateDir =
|
|
1695
|
+
const fileName = path5.basename(filePath, ".md");
|
|
1696
|
+
const dateDir = path5.basename(path5.dirname(filePath));
|
|
1454
1697
|
let relPath;
|
|
1455
1698
|
if (/^\d{4}-\d{2}-\d{2}$/.test(dateDir)) {
|
|
1456
|
-
relPath =
|
|
1699
|
+
relPath = path5.join(category, dateDir, `${fileName}.md`);
|
|
1457
1700
|
} else {
|
|
1458
|
-
relPath =
|
|
1701
|
+
relPath = path5.join(category, `${fileName}.md`);
|
|
1459
1702
|
}
|
|
1460
1703
|
const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1461
1704
|
const md = `# ${fm.id}
|
|
@@ -1501,7 +1744,7 @@ function projectEntityNode(fileName, content) {
|
|
|
1501
1744
|
${content}
|
|
1502
1745
|
`;
|
|
1503
1746
|
return {
|
|
1504
|
-
path:
|
|
1747
|
+
path: path5.join("entities", `${fileName}.md`),
|
|
1505
1748
|
category: "entity",
|
|
1506
1749
|
title: fileName,
|
|
1507
1750
|
content: md,
|
|
@@ -1554,18 +1797,18 @@ function generateIndex(categoryCounts, outputDir) {
|
|
|
1554
1797
|
|
|
1555
1798
|
// src/onboarding/index.ts
|
|
1556
1799
|
import fs3 from "fs";
|
|
1557
|
-
import
|
|
1800
|
+
import path6 from "path";
|
|
1558
1801
|
var LANGUAGE_RULES = [
|
|
1559
1802
|
{
|
|
1560
1803
|
language: "TypeScript",
|
|
1561
1804
|
extensions: [".ts", ".tsx"],
|
|
1562
|
-
manifests: [
|
|
1805
|
+
manifests: [],
|
|
1563
1806
|
configFiles: ["tsconfig.json", "tsup.config.ts"]
|
|
1564
1807
|
},
|
|
1565
1808
|
{
|
|
1566
1809
|
language: "JavaScript",
|
|
1567
1810
|
extensions: [".js", ".jsx", ".mjs", ".cjs"],
|
|
1568
|
-
manifests: [
|
|
1811
|
+
manifests: [],
|
|
1569
1812
|
configFiles: [".eslintrc", ".prettierrc"]
|
|
1570
1813
|
},
|
|
1571
1814
|
{
|
|
@@ -1653,10 +1896,19 @@ var DEFAULT_EXCLUDE = /* @__PURE__ */ new Set([
|
|
|
1653
1896
|
function onboard(options) {
|
|
1654
1897
|
const startTime = Date.now();
|
|
1655
1898
|
const {
|
|
1656
|
-
directory,
|
|
1657
1899
|
maxDepth = 6,
|
|
1658
1900
|
excludeDirs = []
|
|
1659
1901
|
} = options;
|
|
1902
|
+
const directory = path6.resolve(options.directory ?? process.cwd());
|
|
1903
|
+
let rootStat;
|
|
1904
|
+
try {
|
|
1905
|
+
rootStat = fs3.statSync(directory);
|
|
1906
|
+
} catch (err) {
|
|
1907
|
+
throw new Error(`Cannot scan onboarding directory ${directory}: ${err instanceof Error ? err.message : String(err)}`);
|
|
1908
|
+
}
|
|
1909
|
+
if (!rootStat.isDirectory()) {
|
|
1910
|
+
throw new Error(`Cannot scan onboarding directory ${directory}: not a directory`);
|
|
1911
|
+
}
|
|
1660
1912
|
const exclude = /* @__PURE__ */ new Set([...DEFAULT_EXCLUDE, ...excludeDirs]);
|
|
1661
1913
|
const files = walkDir(directory, exclude, maxDepth);
|
|
1662
1914
|
const languages = detectLanguages(files, directory);
|
|
@@ -1681,12 +1933,15 @@ function walkDir(root, exclude, maxDepth) {
|
|
|
1681
1933
|
let entries;
|
|
1682
1934
|
try {
|
|
1683
1935
|
entries = fs3.readdirSync(dir, { withFileTypes: true });
|
|
1684
|
-
} catch {
|
|
1936
|
+
} catch (err) {
|
|
1937
|
+
if (depth === 0) {
|
|
1938
|
+
throw new Error(`Cannot scan onboarding directory ${root}: ${err instanceof Error ? err.message : String(err)}`);
|
|
1939
|
+
}
|
|
1685
1940
|
return;
|
|
1686
1941
|
}
|
|
1687
1942
|
for (const entry of entries) {
|
|
1688
1943
|
if (exclude.has(entry.name)) continue;
|
|
1689
|
-
const fullPath =
|
|
1944
|
+
const fullPath = path6.join(dir, entry.name);
|
|
1690
1945
|
if (entry.isDirectory()) {
|
|
1691
1946
|
walk(fullPath, depth + 1);
|
|
1692
1947
|
} else if (entry.isFile()) {
|
|
@@ -1701,11 +1956,11 @@ function detectLanguages(files, root) {
|
|
|
1701
1956
|
const results = [];
|
|
1702
1957
|
const extCounts = /* @__PURE__ */ new Map();
|
|
1703
1958
|
for (const f of files) {
|
|
1704
|
-
const ext =
|
|
1959
|
+
const ext = path6.extname(f).toLowerCase();
|
|
1705
1960
|
if (ext) extCounts.set(ext, (extCounts.get(ext) ?? 0) + 1);
|
|
1706
1961
|
}
|
|
1707
1962
|
const rootFiles = new Set(
|
|
1708
|
-
files.filter((f) =>
|
|
1963
|
+
files.filter((f) => path6.dirname(f) === root).map((f) => path6.basename(f))
|
|
1709
1964
|
);
|
|
1710
1965
|
for (const rule of LANGUAGE_RULES) {
|
|
1711
1966
|
const evidence = [];
|
|
@@ -1749,7 +2004,7 @@ function detectLanguages(files, root) {
|
|
|
1749
2004
|
}
|
|
1750
2005
|
function detectShape(files, root) {
|
|
1751
2006
|
const rootFiles = new Set(
|
|
1752
|
-
files.filter((f) =>
|
|
2007
|
+
files.filter((f) => path6.dirname(f) === root).map((f) => path6.basename(f))
|
|
1753
2008
|
);
|
|
1754
2009
|
const rootDirs = /* @__PURE__ */ new Set();
|
|
1755
2010
|
try {
|
|
@@ -1760,7 +2015,7 @@ function detectShape(files, root) {
|
|
|
1760
2015
|
}
|
|
1761
2016
|
const evidence = [];
|
|
1762
2017
|
if (rootFiles.has("package.json")) {
|
|
1763
|
-
const pkg = readJsonSafe(
|
|
2018
|
+
const pkg = readJsonSafe(path6.join(root, "package.json"));
|
|
1764
2019
|
if (pkg?.workspaces) {
|
|
1765
2020
|
evidence.push("package.json has workspaces");
|
|
1766
2021
|
return { shape: "monorepo", evidence };
|
|
@@ -1774,13 +2029,13 @@ function detectShape(files, root) {
|
|
|
1774
2029
|
evidence.push("workspace manifest found");
|
|
1775
2030
|
return { shape: "workspace", evidence };
|
|
1776
2031
|
}
|
|
1777
|
-
const cargoToml = readTomlWorkspace(
|
|
2032
|
+
const cargoToml = readTomlWorkspace(path6.join(root, "Cargo.toml"));
|
|
1778
2033
|
if (cargoToml) {
|
|
1779
2034
|
evidence.push("Cargo.toml has workspace");
|
|
1780
2035
|
return { shape: "workspace", evidence };
|
|
1781
2036
|
}
|
|
1782
2037
|
if (rootFiles.has("package.json")) {
|
|
1783
|
-
const pkg = readJsonSafe(
|
|
2038
|
+
const pkg = readJsonSafe(path6.join(root, "package.json"));
|
|
1784
2039
|
if (pkg?.exports || pkg?.main) {
|
|
1785
2040
|
if (pkg?.bin) {
|
|
1786
2041
|
evidence.push("package.json has bin");
|
|
@@ -1814,8 +2069,8 @@ function discoverDocs(files, root) {
|
|
|
1814
2069
|
{ pattern: /^\.editorconfig$/i, kind: "config" }
|
|
1815
2070
|
];
|
|
1816
2071
|
for (const filePath of files) {
|
|
1817
|
-
const basename =
|
|
1818
|
-
const relPath =
|
|
2072
|
+
const basename = path6.basename(filePath).toLowerCase();
|
|
2073
|
+
const relPath = path6.relative(root, filePath);
|
|
1819
2074
|
let kind;
|
|
1820
2075
|
for (const { pattern, kind: k } of docPatterns) {
|
|
1821
2076
|
if (pattern.test(basename)) {
|
|
@@ -1827,7 +2082,7 @@ function discoverDocs(files, root) {
|
|
|
1827
2082
|
kind = "docs";
|
|
1828
2083
|
}
|
|
1829
2084
|
if (!kind && (basename.endsWith(".md") || basename.endsWith(".mdx"))) {
|
|
1830
|
-
if (
|
|
2085
|
+
if (path6.dirname(relPath) === "." || isUnderDocsDir(relPath)) {
|
|
1831
2086
|
kind = "docs";
|
|
1832
2087
|
}
|
|
1833
2088
|
}
|
|
@@ -1848,7 +2103,7 @@ function discoverDocs(files, root) {
|
|
|
1848
2103
|
return docs;
|
|
1849
2104
|
}
|
|
1850
2105
|
function isUnderDocsDir(relPath) {
|
|
1851
|
-
const parts = relPath.split(
|
|
2106
|
+
const parts = relPath.split(path6.sep);
|
|
1852
2107
|
return parts[0] === "docs" || parts[0] === "doc" || parts[0] === "documentation";
|
|
1853
2108
|
}
|
|
1854
2109
|
function buildPlan(languages, shape, docs, _root) {
|
|
@@ -1892,8 +2147,8 @@ function readTomlWorkspace(filePath) {
|
|
|
1892
2147
|
|
|
1893
2148
|
// src/curation/index.ts
|
|
1894
2149
|
import fs4 from "fs";
|
|
1895
|
-
import
|
|
1896
|
-
import
|
|
2150
|
+
import path7 from "path";
|
|
2151
|
+
import crypto4 from "crypto";
|
|
1897
2152
|
async function curate(options) {
|
|
1898
2153
|
const startTime = Date.now();
|
|
1899
2154
|
const {
|
|
@@ -1915,6 +2170,7 @@ async function curate(options) {
|
|
|
1915
2170
|
let filesProcessed = 0;
|
|
1916
2171
|
let filesSkipped = 0;
|
|
1917
2172
|
const targets = resolveTargets(targetPath);
|
|
2173
|
+
const provenanceRoot = resolveProvenanceRoot(targetPath);
|
|
1918
2174
|
const existingMemories = checkDuplicates || checkContradictions ? loadExistingMemories(memoryDir) : /* @__PURE__ */ new Map();
|
|
1919
2175
|
for (const filePath of targets) {
|
|
1920
2176
|
const content = readFileSafe(filePath);
|
|
@@ -1931,7 +2187,7 @@ async function curate(options) {
|
|
|
1931
2187
|
const fileStatements = extractStatements(
|
|
1932
2188
|
content,
|
|
1933
2189
|
filePath,
|
|
1934
|
-
|
|
2190
|
+
provenanceRoot,
|
|
1935
2191
|
source,
|
|
1936
2192
|
sourceFileHash,
|
|
1937
2193
|
categoryOverride,
|
|
@@ -1956,14 +2212,12 @@ async function curate(options) {
|
|
|
1956
2212
|
statements.push(stmt);
|
|
1957
2213
|
if (write) {
|
|
1958
2214
|
const writtenPath = writeStatement(stmt, memoryDir);
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
});
|
|
1966
|
-
}
|
|
2215
|
+
written.push(writtenPath);
|
|
2216
|
+
existingMemories.set(stmt.contentHash, {
|
|
2217
|
+
id: stmt.id,
|
|
2218
|
+
content: stmt.content,
|
|
2219
|
+
category: stmt.category
|
|
2220
|
+
});
|
|
1967
2221
|
}
|
|
1968
2222
|
}
|
|
1969
2223
|
}
|
|
@@ -1984,12 +2238,12 @@ function resolveTargets(targetPath) {
|
|
|
1984
2238
|
const extensions = /* @__PURE__ */ new Set([".md", ".txt", ".mdx", ".rst"]);
|
|
1985
2239
|
function walk(dir) {
|
|
1986
2240
|
for (const entry of fs4.readdirSync(dir, { withFileTypes: true })) {
|
|
1987
|
-
const fullPath =
|
|
2241
|
+
const fullPath = path7.join(dir, entry.name);
|
|
1988
2242
|
if (entry.isDirectory()) {
|
|
1989
2243
|
if (entry.name !== "node_modules" && entry.name !== ".git") {
|
|
1990
2244
|
walk(fullPath);
|
|
1991
2245
|
}
|
|
1992
|
-
} else if (extensions.has(
|
|
2246
|
+
} else if (extensions.has(path7.extname(entry.name).toLowerCase())) {
|
|
1993
2247
|
results.push(fullPath);
|
|
1994
2248
|
}
|
|
1995
2249
|
}
|
|
@@ -1997,8 +2251,13 @@ function resolveTargets(targetPath) {
|
|
|
1997
2251
|
walk(targetPath);
|
|
1998
2252
|
return results;
|
|
1999
2253
|
}
|
|
2254
|
+
function resolveProvenanceRoot(targetPath) {
|
|
2255
|
+
const resolvedTarget = path7.resolve(targetPath);
|
|
2256
|
+
const stat = fs4.statSync(resolvedTarget);
|
|
2257
|
+
return stat.isFile() ? path7.dirname(resolvedTarget) : resolvedTarget;
|
|
2258
|
+
}
|
|
2000
2259
|
function extractStatements(content, filePath, projectRoot, source, sourceFileHash, categoryOverride, confidence, entityRef, tags) {
|
|
2001
|
-
const relativePath =
|
|
2260
|
+
const relativePath = path7.relative(projectRoot, path7.resolve(filePath)) || path7.basename(filePath);
|
|
2002
2261
|
const statements = [];
|
|
2003
2262
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2004
2263
|
const paragraphs = content.split(/\n{2,}/).map((p) => p.trim()).filter((p) => p.length > 20 && p.length < 2e3);
|
|
@@ -2092,7 +2351,7 @@ function loadExistingMemories(memoryDir) {
|
|
|
2092
2351
|
if (!fs4.existsSync(memoryDir)) return result;
|
|
2093
2352
|
const dirs = ALL_CATEGORY_DIRS;
|
|
2094
2353
|
for (const dir of dirs) {
|
|
2095
|
-
const fullDir =
|
|
2354
|
+
const fullDir = path7.join(memoryDir, dir);
|
|
2096
2355
|
if (!fs4.existsSync(fullDir)) continue;
|
|
2097
2356
|
walkFiles(fullDir, (filePath) => {
|
|
2098
2357
|
const content = readFileSafe(filePath);
|
|
@@ -2114,10 +2373,10 @@ function writeStatement(stmt, memoryDir) {
|
|
|
2114
2373
|
const now = /* @__PURE__ */ new Date();
|
|
2115
2374
|
const dateDir = now.toISOString().split("T")[0];
|
|
2116
2375
|
const categoryDir = getCategoryDir(memoryDir, stmt.category);
|
|
2117
|
-
const dir =
|
|
2376
|
+
const dir = path7.join(categoryDir, dateDir);
|
|
2118
2377
|
fs4.mkdirSync(dir, { recursive: true });
|
|
2119
2378
|
const fileName = `${stmt.category}-${Date.now()}-${stmt.id.slice(0, 8)}.md`;
|
|
2120
|
-
const filePath =
|
|
2379
|
+
const filePath = path7.join(dir, fileName);
|
|
2121
2380
|
const frontmatter = [
|
|
2122
2381
|
"---",
|
|
2123
2382
|
`id: ${stmt.id}`,
|
|
@@ -2137,18 +2396,14 @@ function writeStatement(stmt, memoryDir) {
|
|
|
2137
2396
|
|
|
2138
2397
|
${stmt.content}
|
|
2139
2398
|
`;
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
return filePath;
|
|
2143
|
-
} catch {
|
|
2144
|
-
return null;
|
|
2145
|
-
}
|
|
2399
|
+
fs4.writeFileSync(filePath, body);
|
|
2400
|
+
return filePath;
|
|
2146
2401
|
}
|
|
2147
2402
|
function generateId() {
|
|
2148
|
-
return
|
|
2403
|
+
return crypto4.randomUUID();
|
|
2149
2404
|
}
|
|
2150
2405
|
function hashContent(content) {
|
|
2151
|
-
return
|
|
2406
|
+
return crypto4.createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
2152
2407
|
}
|
|
2153
2408
|
function tierFromConfidence(confidence) {
|
|
2154
2409
|
if (confidence >= 0.95) return "explicit";
|
|
@@ -2188,7 +2443,7 @@ function extractBody2(content) {
|
|
|
2188
2443
|
}
|
|
2189
2444
|
function walkFiles(dir, callback) {
|
|
2190
2445
|
for (const entry of fs4.readdirSync(dir, { withFileTypes: true })) {
|
|
2191
|
-
const fullPath =
|
|
2446
|
+
const fullPath = path7.join(dir, entry.name);
|
|
2192
2447
|
if (entry.isDirectory()) {
|
|
2193
2448
|
walkFiles(fullPath, callback);
|
|
2194
2449
|
} else if (entry.name.endsWith(".md")) {
|
|
@@ -2199,11 +2454,21 @@ function walkFiles(dir, callback) {
|
|
|
2199
2454
|
|
|
2200
2455
|
// src/dedup/index.ts
|
|
2201
2456
|
import fs5 from "fs";
|
|
2202
|
-
import
|
|
2203
|
-
import
|
|
2457
|
+
import path8 from "path";
|
|
2458
|
+
import crypto5 from "crypto";
|
|
2459
|
+
var DEFAULT_DEDUP_THRESHOLD = 0.85;
|
|
2460
|
+
var DEFAULT_MAX_LOAD = 1e4;
|
|
2461
|
+
function normalizeThreshold(value, defaultValue) {
|
|
2462
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1 ? value : defaultValue;
|
|
2463
|
+
}
|
|
2464
|
+
function normalizeMaxLoad(value, defaultValue) {
|
|
2465
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : defaultValue;
|
|
2466
|
+
}
|
|
2204
2467
|
function findDuplicates(options) {
|
|
2205
2468
|
const startTime = Date.now();
|
|
2206
|
-
const { memoryDir
|
|
2469
|
+
const { memoryDir } = options;
|
|
2470
|
+
const threshold = normalizeThreshold(options.threshold, DEFAULT_DEDUP_THRESHOLD);
|
|
2471
|
+
const maxLoad = normalizeMaxLoad(options.maxLoad, DEFAULT_MAX_LOAD);
|
|
2207
2472
|
const memories = loadMemories(memoryDir, options.categories, maxLoad);
|
|
2208
2473
|
const duplicates = [];
|
|
2209
2474
|
for (let i = 0; i < memories.length; i++) {
|
|
@@ -2227,7 +2492,8 @@ function findDuplicates(options) {
|
|
|
2227
2492
|
}
|
|
2228
2493
|
function findContradictions(options) {
|
|
2229
2494
|
const startTime = Date.now();
|
|
2230
|
-
const { memoryDir
|
|
2495
|
+
const { memoryDir } = options;
|
|
2496
|
+
const maxLoad = normalizeMaxLoad(options.maxLoad, DEFAULT_MAX_LOAD);
|
|
2231
2497
|
const memories = loadMemories(memoryDir, options.categories, maxLoad);
|
|
2232
2498
|
const contradictions = [];
|
|
2233
2499
|
for (let i = 0; i < memories.length; i++) {
|
|
@@ -2272,6 +2538,7 @@ var NEGATION_WORDS = /* @__PURE__ */ new Set([
|
|
|
2272
2538
|
"aren't",
|
|
2273
2539
|
"won't",
|
|
2274
2540
|
"can't",
|
|
2541
|
+
"cannot",
|
|
2275
2542
|
"never",
|
|
2276
2543
|
"no",
|
|
2277
2544
|
"none",
|
|
@@ -2320,18 +2587,27 @@ function containsNegation(text) {
|
|
|
2320
2587
|
return words.some((w) => NEGATION_WORDS.has(w));
|
|
2321
2588
|
}
|
|
2322
2589
|
function stripNegation(text) {
|
|
2323
|
-
return text.replace(/\b(not|don't|doesn't|isn't|aren't|won't|can't|never|no|none|neither|nor|nothing|nowhere)\b/gi, "").replace(/\s+/g, " ").trim();
|
|
2590
|
+
return text.replace(/\b(not|don't|doesn't|isn't|aren't|won't|can't|cannot|never|no|none|neither|nor|nothing|nowhere)\b/gi, "").replace(/\s+/g, " ").trim();
|
|
2324
2591
|
}
|
|
2325
2592
|
function loadMemories(memoryDir, categories, maxLoad = 1e4) {
|
|
2326
2593
|
const result = [];
|
|
2327
2594
|
const allCategories = categories ?? ALL_CATEGORY_DIRS;
|
|
2595
|
+
if (!fs5.existsSync(memoryDir)) return result;
|
|
2596
|
+
const memoryRootReal = fs5.realpathSync(memoryDir);
|
|
2328
2597
|
for (const category of allCategories) {
|
|
2329
2598
|
if (result.length >= maxLoad) break;
|
|
2330
|
-
const dir =
|
|
2599
|
+
const dir = path8.join(memoryDir, category);
|
|
2331
2600
|
if (!fs5.existsSync(dir)) continue;
|
|
2332
|
-
|
|
2601
|
+
const categoryStat = fs5.lstatSync(dir);
|
|
2602
|
+
if (categoryStat.isSymbolicLink()) {
|
|
2603
|
+
throw new Error(`Refusing to scan symlinked memory category directory: ${dir}`);
|
|
2604
|
+
}
|
|
2605
|
+
if (!categoryStat.isDirectory()) continue;
|
|
2606
|
+
const categoryRootReal = fs5.realpathSync(dir);
|
|
2607
|
+
assertPathInsideRoot(memoryRootReal, categoryRootReal, dir);
|
|
2608
|
+
walkMdFiles(dir, memoryRootReal, categoryRootReal, (filePath) => {
|
|
2333
2609
|
if (result.length >= maxLoad) return;
|
|
2334
|
-
const content = readFileSafe2(filePath);
|
|
2610
|
+
const content = readFileSafe2(filePath, memoryRootReal, categoryRootReal);
|
|
2335
2611
|
if (!content) return;
|
|
2336
2612
|
const fm = parseFrontmatter3(content);
|
|
2337
2613
|
const body = extractBody3(content);
|
|
@@ -2347,10 +2623,17 @@ function loadMemories(memoryDir, categories, maxLoad = 1e4) {
|
|
|
2347
2623
|
return result;
|
|
2348
2624
|
}
|
|
2349
2625
|
function hashContent2(content) {
|
|
2350
|
-
return
|
|
2626
|
+
return crypto5.createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
2351
2627
|
}
|
|
2352
|
-
function readFileSafe2(filePath) {
|
|
2628
|
+
function readFileSafe2(filePath, memoryRootReal, categoryRootReal) {
|
|
2353
2629
|
try {
|
|
2630
|
+
const fileStat = fs5.lstatSync(filePath);
|
|
2631
|
+
if (fileStat.isSymbolicLink()) {
|
|
2632
|
+
throw new Error(`Refusing to read symlinked memory file: ${filePath}`);
|
|
2633
|
+
}
|
|
2634
|
+
const fileReal = fs5.realpathSync(filePath);
|
|
2635
|
+
assertPathInsideRoot(memoryRootReal, fileReal, filePath);
|
|
2636
|
+
assertPathInsideRoot(categoryRootReal, fileReal, filePath);
|
|
2354
2637
|
return fs5.readFileSync(filePath, "utf8");
|
|
2355
2638
|
} catch {
|
|
2356
2639
|
return null;
|
|
@@ -2373,11 +2656,25 @@ function extractBody3(content) {
|
|
|
2373
2656
|
const match = content.match(/^---\n[\s\S]*?\n---\n([\s\S]*)/);
|
|
2374
2657
|
return match ? match[1].trim() : content.trim();
|
|
2375
2658
|
}
|
|
2376
|
-
function
|
|
2659
|
+
function assertPathInsideRoot(rootReal, targetReal, sourcePath) {
|
|
2660
|
+
const rel = path8.relative(rootReal, targetReal);
|
|
2661
|
+
if (rel === "" || !rel.startsWith("..") && !path8.isAbsolute(rel)) {
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2664
|
+
throw new Error(`Refusing to scan memory path outside root: ${sourcePath}`);
|
|
2665
|
+
}
|
|
2666
|
+
function walkMdFiles(dir, memoryRootReal, categoryRootReal, callback) {
|
|
2377
2667
|
for (const entry of fs5.readdirSync(dir, { withFileTypes: true })) {
|
|
2378
|
-
const fullPath =
|
|
2379
|
-
|
|
2380
|
-
|
|
2668
|
+
const fullPath = path8.join(dir, entry.name);
|
|
2669
|
+
const entryStat = fs5.lstatSync(fullPath);
|
|
2670
|
+
if (entryStat.isSymbolicLink()) {
|
|
2671
|
+
throw new Error(`Refusing to scan symlinked memory path: ${fullPath}`);
|
|
2672
|
+
}
|
|
2673
|
+
const entryReal = fs5.realpathSync(fullPath);
|
|
2674
|
+
assertPathInsideRoot(memoryRootReal, entryReal, fullPath);
|
|
2675
|
+
assertPathInsideRoot(categoryRootReal, entryReal, fullPath);
|
|
2676
|
+
if (entryStat.isDirectory()) {
|
|
2677
|
+
walkMdFiles(fullPath, memoryRootReal, categoryRootReal, callback);
|
|
2381
2678
|
} else if (entry.name.endsWith(".md")) {
|
|
2382
2679
|
callback(fullPath);
|
|
2383
2680
|
}
|
|
@@ -2386,8 +2683,42 @@ function walkMdFiles(dir, callback) {
|
|
|
2386
2683
|
|
|
2387
2684
|
// src/review/index.ts
|
|
2388
2685
|
import fs6 from "fs";
|
|
2389
|
-
import
|
|
2686
|
+
import path9 from "path";
|
|
2390
2687
|
var DEFAULT_CONFIDENCE_THRESHOLD = 0.7;
|
|
2688
|
+
function realMemoryRoot(memoryDir) {
|
|
2689
|
+
try {
|
|
2690
|
+
const stat = fs6.lstatSync(memoryDir);
|
|
2691
|
+
if (!stat.isDirectory() || stat.isSymbolicLink()) return null;
|
|
2692
|
+
return fs6.realpathSync(memoryDir);
|
|
2693
|
+
} catch {
|
|
2694
|
+
return null;
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
function isPathInside2(rootReal, candidateReal) {
|
|
2698
|
+
const relative = path9.relative(rootReal, candidateReal);
|
|
2699
|
+
return relative === "" || !!relative && !relative.startsWith("..") && !path9.isAbsolute(relative);
|
|
2700
|
+
}
|
|
2701
|
+
function isSafeDirectory(rootReal, dir) {
|
|
2702
|
+
try {
|
|
2703
|
+
const stat = fs6.lstatSync(dir);
|
|
2704
|
+
if (!stat.isDirectory() || stat.isSymbolicLink()) return false;
|
|
2705
|
+
return isPathInside2(rootReal, fs6.realpathSync(dir));
|
|
2706
|
+
} catch {
|
|
2707
|
+
return false;
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
function ensureSafeDirectory(rootReal, dir) {
|
|
2711
|
+
if (fs6.existsSync(dir)) {
|
|
2712
|
+
if (!isSafeDirectory(rootReal, dir)) {
|
|
2713
|
+
throw new Error(`Refusing to write through unsafe review path: ${dir}`);
|
|
2714
|
+
}
|
|
2715
|
+
return;
|
|
2716
|
+
}
|
|
2717
|
+
fs6.mkdirSync(dir, { recursive: true });
|
|
2718
|
+
if (!isSafeDirectory(rootReal, dir)) {
|
|
2719
|
+
throw new Error(`Refusing to write through unsafe review path: ${dir}`);
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2391
2722
|
function listReviewItems(options) {
|
|
2392
2723
|
const startTime = Date.now();
|
|
2393
2724
|
const {
|
|
@@ -2396,19 +2727,25 @@ function listReviewItems(options) {
|
|
|
2396
2727
|
limit = 50,
|
|
2397
2728
|
confidenceThreshold = DEFAULT_CONFIDENCE_THRESHOLD
|
|
2398
2729
|
} = options;
|
|
2730
|
+
const maxItems = Math.max(0, limit);
|
|
2731
|
+
const rootReal = realMemoryRoot(memoryDir);
|
|
2732
|
+
if (!rootReal || maxItems === 0) {
|
|
2733
|
+
return { items: [], total: 0, durationMs: Date.now() - startTime };
|
|
2734
|
+
}
|
|
2399
2735
|
const items = [];
|
|
2736
|
+
const isLimitReached = () => items.length >= maxItems;
|
|
2400
2737
|
const addItem = (item) => {
|
|
2401
|
-
if (
|
|
2738
|
+
if (isLimitReached()) return;
|
|
2402
2739
|
if (filterReason && item.reviewReason !== filterReason) return;
|
|
2403
2740
|
items.push(item);
|
|
2404
2741
|
};
|
|
2405
|
-
const suggestionsDir =
|
|
2406
|
-
if (fs6.existsSync(suggestionsDir)) {
|
|
2407
|
-
walkMd(suggestionsDir, (filePath, content) => {
|
|
2408
|
-
if (
|
|
2742
|
+
const suggestionsDir = path9.join(memoryDir, "suggestions");
|
|
2743
|
+
if (!isLimitReached() && fs6.existsSync(suggestionsDir) && isSafeDirectory(rootReal, suggestionsDir)) {
|
|
2744
|
+
walkMd(rootReal, suggestionsDir, (filePath, content) => {
|
|
2745
|
+
if (isLimitReached()) return true;
|
|
2409
2746
|
const fm = parseFrontmatter4(content);
|
|
2410
2747
|
const body = extractBody4(content);
|
|
2411
|
-
if (!fm?.id) return;
|
|
2748
|
+
if (!fm?.id) return false;
|
|
2412
2749
|
addItem({
|
|
2413
2750
|
id: fm.id,
|
|
2414
2751
|
content: body,
|
|
@@ -2420,15 +2757,16 @@ function listReviewItems(options) {
|
|
|
2420
2757
|
created: fm.created ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
2421
2758
|
reviewReason: "suggestion"
|
|
2422
2759
|
});
|
|
2760
|
+
return isLimitReached();
|
|
2423
2761
|
});
|
|
2424
2762
|
}
|
|
2425
|
-
const reviewDir =
|
|
2426
|
-
if (fs6.existsSync(reviewDir)) {
|
|
2427
|
-
walkMd(reviewDir, (filePath, content) => {
|
|
2428
|
-
if (
|
|
2763
|
+
const reviewDir = path9.join(memoryDir, "review");
|
|
2764
|
+
if (!isLimitReached() && fs6.existsSync(reviewDir) && isSafeDirectory(rootReal, reviewDir)) {
|
|
2765
|
+
walkMd(rootReal, reviewDir, (filePath, content) => {
|
|
2766
|
+
if (isLimitReached()) return true;
|
|
2429
2767
|
const fm = parseFrontmatter4(content);
|
|
2430
2768
|
const body = extractBody4(content);
|
|
2431
|
-
if (!fm?.id) return;
|
|
2769
|
+
if (!fm?.id) return false;
|
|
2432
2770
|
addItem({
|
|
2433
2771
|
id: fm.id,
|
|
2434
2772
|
content: body,
|
|
@@ -2441,22 +2779,23 @@ function listReviewItems(options) {
|
|
|
2441
2779
|
reviewReason: fm.reviewReason ?? "low_confidence",
|
|
2442
2780
|
context: fm.context
|
|
2443
2781
|
});
|
|
2782
|
+
return isLimitReached();
|
|
2444
2783
|
});
|
|
2445
2784
|
}
|
|
2446
2785
|
const categories = ALL_CATEGORY_DIRS;
|
|
2447
2786
|
for (const category of categories) {
|
|
2448
|
-
if (
|
|
2449
|
-
const dir =
|
|
2450
|
-
if (!fs6.existsSync(dir)) continue;
|
|
2451
|
-
walkMd(dir, (filePath, content) => {
|
|
2452
|
-
if (
|
|
2787
|
+
if (isLimitReached()) break;
|
|
2788
|
+
const dir = path9.join(memoryDir, category);
|
|
2789
|
+
if (!fs6.existsSync(dir) || !isSafeDirectory(rootReal, dir)) continue;
|
|
2790
|
+
walkMd(rootReal, dir, (filePath, content) => {
|
|
2791
|
+
if (isLimitReached()) return true;
|
|
2453
2792
|
const fm = parseFrontmatter4(content);
|
|
2454
2793
|
const body = extractBody4(content);
|
|
2455
|
-
if (!fm?.id) return;
|
|
2794
|
+
if (!fm?.id) return false;
|
|
2456
2795
|
const confidence = parseConfidence(fm.confidence, 1);
|
|
2457
|
-
if (confidence >= confidenceThreshold) return;
|
|
2458
|
-
if (parseBoolean(fm.reviewDismissed)) return;
|
|
2459
|
-
if (items.some((i) => i.id === fm.id)) return;
|
|
2796
|
+
if (confidence >= confidenceThreshold) return false;
|
|
2797
|
+
if (parseBoolean(fm.reviewDismissed)) return false;
|
|
2798
|
+
if (items.some((i) => i.id === fm.id)) return false;
|
|
2460
2799
|
addItem({
|
|
2461
2800
|
id: fm.id,
|
|
2462
2801
|
content: body,
|
|
@@ -2468,6 +2807,7 @@ function listReviewItems(options) {
|
|
|
2468
2807
|
created: fm.created ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
2469
2808
|
reviewReason: "low_confidence"
|
|
2470
2809
|
});
|
|
2810
|
+
return isLimitReached();
|
|
2471
2811
|
});
|
|
2472
2812
|
}
|
|
2473
2813
|
return {
|
|
@@ -2487,6 +2827,8 @@ function performReview(memoryDir, itemId, action, options = {}) {
|
|
|
2487
2827
|
}
|
|
2488
2828
|
}
|
|
2489
2829
|
function approveItem(memoryDir, itemId, options) {
|
|
2830
|
+
const rootReal = realMemoryRoot(memoryDir);
|
|
2831
|
+
if (!rootReal) return { itemId, action: "approve", message: "Item not found" };
|
|
2490
2832
|
const found = findReviewFileById(memoryDir, itemId, options);
|
|
2491
2833
|
if (!found) {
|
|
2492
2834
|
return { itemId, action: "approve", message: "Item not found" };
|
|
@@ -2511,8 +2853,9 @@ function approveItem(memoryDir, itemId, options) {
|
|
|
2511
2853
|
const category = fm.category ?? "fact";
|
|
2512
2854
|
const targetDir = getCategoryDir(memoryDir, category);
|
|
2513
2855
|
const dateDir = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
2514
|
-
|
|
2515
|
-
|
|
2856
|
+
ensureSafeDirectory(rootReal, targetDir);
|
|
2857
|
+
const outputPath = path9.join(targetDir, dateDir, path9.basename(found.filePath));
|
|
2858
|
+
ensureSafeDirectory(rootReal, path9.dirname(outputPath));
|
|
2516
2859
|
const promotedPath = writeFileWithoutClobber(outputPath, updatedContent, itemId);
|
|
2517
2860
|
fs6.unlinkSync(found.filePath);
|
|
2518
2861
|
return {
|
|
@@ -2566,22 +2909,24 @@ function flagItem(memoryDir, itemId, options) {
|
|
|
2566
2909
|
};
|
|
2567
2910
|
}
|
|
2568
2911
|
function findReviewFileById(memoryDir, id, options = {}) {
|
|
2912
|
+
const rootReal = realMemoryRoot(memoryDir);
|
|
2913
|
+
if (!rootReal) return null;
|
|
2569
2914
|
for (const loc of ["suggestions", "review"]) {
|
|
2570
|
-
const dir =
|
|
2571
|
-
if (!fs6.existsSync(dir)) continue;
|
|
2572
|
-
const found = findFileById(dir, id);
|
|
2915
|
+
const dir = path9.join(memoryDir, loc);
|
|
2916
|
+
if (!fs6.existsSync(dir) || !isSafeDirectory(rootReal, dir)) continue;
|
|
2917
|
+
const found = findFileById(rootReal, dir, id);
|
|
2573
2918
|
if (found) return { filePath: found, location: "queue" };
|
|
2574
2919
|
}
|
|
2575
2920
|
for (const category of ALL_CATEGORY_DIRS) {
|
|
2576
|
-
const dir =
|
|
2577
|
-
if (!fs6.existsSync(dir)) continue;
|
|
2578
|
-
const found = findFileById(dir, id, (fm) => isLowConfidenceReviewCandidate(fm, options));
|
|
2921
|
+
const dir = path9.join(memoryDir, category);
|
|
2922
|
+
if (!fs6.existsSync(dir) || !isSafeDirectory(rootReal, dir)) continue;
|
|
2923
|
+
const found = findFileById(rootReal, dir, id, (fm) => isLowConfidenceReviewCandidate(fm, options));
|
|
2579
2924
|
if (found) return { filePath: found, location: "category" };
|
|
2580
2925
|
}
|
|
2581
2926
|
return null;
|
|
2582
2927
|
}
|
|
2583
|
-
function findFileById(dir, id, include) {
|
|
2584
|
-
const files = walkMdPaths(dir);
|
|
2928
|
+
function findFileById(rootReal, dir, id, include) {
|
|
2929
|
+
const files = walkMdPaths(rootReal, dir);
|
|
2585
2930
|
for (const filePath of files) {
|
|
2586
2931
|
const content = readFileSafe3(filePath);
|
|
2587
2932
|
if (!content) continue;
|
|
@@ -2646,10 +2991,10 @@ function readFileSafe3(filePath) {
|
|
|
2646
2991
|
}
|
|
2647
2992
|
}
|
|
2648
2993
|
function writeFileWithoutClobber(basePath, content, discriminator) {
|
|
2649
|
-
const parsed =
|
|
2994
|
+
const parsed = path9.parse(basePath);
|
|
2650
2995
|
const safeDiscriminator = sanitizeFilePart(discriminator);
|
|
2651
2996
|
for (let attempt = 0; attempt < 1e3; attempt++) {
|
|
2652
|
-
const candidate = attempt === 0 ? basePath :
|
|
2997
|
+
const candidate = attempt === 0 ? basePath : path9.join(
|
|
2653
2998
|
parsed.dir,
|
|
2654
2999
|
`${parsed.name}-${safeDiscriminator}${attempt === 1 ? "" : `-${attempt}`}${parsed.ext || ".md"}`
|
|
2655
3000
|
);
|
|
@@ -2702,24 +3047,29 @@ function extractBody4(content) {
|
|
|
2702
3047
|
const match = content.match(/^---\n[\s\S]*?\n---\n([\s\S]*)/);
|
|
2703
3048
|
return match ? match[1].trim() : content.trim();
|
|
2704
3049
|
}
|
|
2705
|
-
function walkMd(dir, callback) {
|
|
3050
|
+
function walkMd(rootReal, dir, callback) {
|
|
3051
|
+
if (!isSafeDirectory(rootReal, dir)) return false;
|
|
2706
3052
|
for (const entry of fs6.readdirSync(dir, { withFileTypes: true })) {
|
|
2707
|
-
const fullPath =
|
|
3053
|
+
const fullPath = path9.join(dir, entry.name);
|
|
3054
|
+
if (entry.isSymbolicLink()) continue;
|
|
2708
3055
|
if (entry.isDirectory()) {
|
|
2709
|
-
walkMd(fullPath, callback);
|
|
2710
|
-
} else if (entry.name.endsWith(".md")) {
|
|
3056
|
+
if (walkMd(rootReal, fullPath, callback)) return true;
|
|
3057
|
+
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
2711
3058
|
const content = readFileSafe3(fullPath);
|
|
2712
|
-
if (content
|
|
3059
|
+
if (content && callback(fullPath, content) === true) return true;
|
|
2713
3060
|
}
|
|
2714
3061
|
}
|
|
3062
|
+
return false;
|
|
2715
3063
|
}
|
|
2716
|
-
function walkMdPaths(dir) {
|
|
3064
|
+
function walkMdPaths(rootReal, dir) {
|
|
2717
3065
|
const results = [];
|
|
3066
|
+
if (!isSafeDirectory(rootReal, dir)) return results;
|
|
2718
3067
|
for (const entry of fs6.readdirSync(dir, { withFileTypes: true })) {
|
|
2719
|
-
const fullPath =
|
|
3068
|
+
const fullPath = path9.join(dir, entry.name);
|
|
3069
|
+
if (entry.isSymbolicLink()) continue;
|
|
2720
3070
|
if (entry.isDirectory()) {
|
|
2721
|
-
results.push(...walkMdPaths(fullPath));
|
|
2722
|
-
} else if (entry.name.endsWith(".md")) {
|
|
3071
|
+
results.push(...walkMdPaths(rootReal, fullPath));
|
|
3072
|
+
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
2723
3073
|
results.push(fullPath);
|
|
2724
3074
|
}
|
|
2725
3075
|
}
|
|
@@ -2728,8 +3078,8 @@ function walkMdPaths(dir) {
|
|
|
2728
3078
|
|
|
2729
3079
|
// src/sync/index.ts
|
|
2730
3080
|
import fs7 from "fs";
|
|
2731
|
-
import
|
|
2732
|
-
import
|
|
3081
|
+
import path10 from "path";
|
|
3082
|
+
import crypto6 from "crypto";
|
|
2733
3083
|
var DEFAULT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".txt", ".mdx", ".rst"]);
|
|
2734
3084
|
var DEFAULT_EXCLUDE2 = /* @__PURE__ */ new Set([
|
|
2735
3085
|
"node_modules",
|
|
@@ -2750,7 +3100,7 @@ function syncChanges(options) {
|
|
|
2750
3100
|
} = options;
|
|
2751
3101
|
const extSet = new Set(extensions);
|
|
2752
3102
|
const excludeSet = /* @__PURE__ */ new Set([...DEFAULT_EXCLUDE2, ...excludeDirs]);
|
|
2753
|
-
const stateFilePath = options.stateFile ??
|
|
3103
|
+
const stateFilePath = options.stateFile ?? path10.join(memoryDir, ".sync-state.json");
|
|
2754
3104
|
const prevState = loadState(stateFilePath);
|
|
2755
3105
|
const currentFiles = scanFiles(sourceDir, extSet, excludeSet);
|
|
2756
3106
|
const changes = computeDiff(currentFiles, prevState.fileHashes, sourceDir);
|
|
@@ -2766,7 +3116,7 @@ function syncChanges(options) {
|
|
|
2766
3116
|
for (const [relPath, hash] of Object.entries(currentFiles)) {
|
|
2767
3117
|
newState.fileHashes[relPath] = hash;
|
|
2768
3118
|
}
|
|
2769
|
-
fs7.mkdirSync(
|
|
3119
|
+
fs7.mkdirSync(path10.dirname(stateFilePath), { recursive: true });
|
|
2770
3120
|
fs7.writeFileSync(stateFilePath, JSON.stringify(newState, null, 2));
|
|
2771
3121
|
}
|
|
2772
3122
|
return {
|
|
@@ -2783,45 +3133,62 @@ function watchForChanges(options, onChange) {
|
|
|
2783
3133
|
const { sourceDir, extensions, excludeDirs } = options;
|
|
2784
3134
|
const extSet = new Set(extensions ?? DEFAULT_EXTENSIONS);
|
|
2785
3135
|
const excludeSet = /* @__PURE__ */ new Set([...DEFAULT_EXCLUDE2, ...excludeDirs ?? []]);
|
|
3136
|
+
const pollIntervalMs = typeof options.pollIntervalMs === "number" && Number.isFinite(options.pollIntervalMs) && options.pollIntervalMs > 0 ? options.pollIntervalMs : 5e3;
|
|
2786
3137
|
let lastHashes = {};
|
|
3138
|
+
let pollInFlight = false;
|
|
2787
3139
|
const currentFiles = scanFiles(sourceDir, extSet, excludeSet);
|
|
2788
3140
|
lastHashes = { ...currentFiles };
|
|
2789
|
-
const
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
3141
|
+
const poll = async () => {
|
|
3142
|
+
if (pollInFlight) return;
|
|
3143
|
+
pollInFlight = true;
|
|
3144
|
+
try {
|
|
3145
|
+
const nowFiles = scanFiles(sourceDir, extSet, excludeSet);
|
|
3146
|
+
const changes = computeDiff(nowFiles, lastHashes, sourceDir);
|
|
3147
|
+
if (changes.length > 0) {
|
|
3148
|
+
await onChange(changes);
|
|
3149
|
+
for (const change of changes) {
|
|
3150
|
+
if (change.type === "deleted") {
|
|
3151
|
+
delete lastHashes[change.relativePath];
|
|
3152
|
+
} else {
|
|
3153
|
+
lastHashes[change.relativePath] = change.currentHash;
|
|
3154
|
+
}
|
|
2798
3155
|
}
|
|
2799
3156
|
}
|
|
2800
|
-
|
|
3157
|
+
} catch {
|
|
3158
|
+
} finally {
|
|
3159
|
+
pollInFlight = false;
|
|
2801
3160
|
}
|
|
2802
|
-
}
|
|
3161
|
+
};
|
|
3162
|
+
const interval = setInterval(() => {
|
|
3163
|
+
void poll();
|
|
3164
|
+
}, pollIntervalMs);
|
|
2803
3165
|
return {
|
|
2804
3166
|
stop: () => clearInterval(interval)
|
|
2805
3167
|
};
|
|
2806
3168
|
}
|
|
2807
3169
|
function scanFiles(root, extensions, exclude) {
|
|
2808
3170
|
const result = {};
|
|
2809
|
-
function walk(dir) {
|
|
3171
|
+
function walk(dir, isRoot = false) {
|
|
2810
3172
|
let entries;
|
|
2811
3173
|
try {
|
|
2812
3174
|
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
2813
|
-
} catch {
|
|
3175
|
+
} catch (err) {
|
|
3176
|
+
if (isRoot) {
|
|
3177
|
+
throw new Error(
|
|
3178
|
+
`sync scan failed for ${dir}: ${err instanceof Error ? err.message : String(err)}`
|
|
3179
|
+
);
|
|
3180
|
+
}
|
|
2814
3181
|
return;
|
|
2815
3182
|
}
|
|
2816
3183
|
for (const entry of entries) {
|
|
2817
3184
|
if (exclude.has(entry.name)) continue;
|
|
2818
|
-
const fullPath =
|
|
3185
|
+
const fullPath = path10.join(dir, entry.name);
|
|
2819
3186
|
if (entry.isDirectory()) {
|
|
2820
3187
|
walk(fullPath);
|
|
2821
3188
|
} else if (entry.isFile()) {
|
|
2822
|
-
const ext =
|
|
3189
|
+
const ext = path10.extname(entry.name).toLowerCase();
|
|
2823
3190
|
if (!extensions.has(ext)) continue;
|
|
2824
|
-
const relPath =
|
|
3191
|
+
const relPath = path10.relative(root, fullPath);
|
|
2825
3192
|
try {
|
|
2826
3193
|
const content = fs7.readFileSync(fullPath, "utf8");
|
|
2827
3194
|
result[relPath] = hashContent3(content);
|
|
@@ -2830,13 +3197,13 @@ function scanFiles(root, extensions, exclude) {
|
|
|
2830
3197
|
}
|
|
2831
3198
|
}
|
|
2832
3199
|
}
|
|
2833
|
-
walk(root);
|
|
3200
|
+
walk(root, true);
|
|
2834
3201
|
return result;
|
|
2835
3202
|
}
|
|
2836
3203
|
function computeDiff(current, previous, sourceDir) {
|
|
2837
3204
|
const changes = [];
|
|
2838
3205
|
for (const [relPath, hash] of Object.entries(current)) {
|
|
2839
|
-
const fullPath =
|
|
3206
|
+
const fullPath = path10.join(sourceDir, relPath);
|
|
2840
3207
|
if (!(relPath in previous)) {
|
|
2841
3208
|
let size = 0;
|
|
2842
3209
|
try {
|
|
@@ -2869,7 +3236,7 @@ function computeDiff(current, previous, sourceDir) {
|
|
|
2869
3236
|
for (const relPath of Object.keys(previous)) {
|
|
2870
3237
|
if (!(relPath in current)) {
|
|
2871
3238
|
changes.push({
|
|
2872
|
-
filePath:
|
|
3239
|
+
filePath: path10.join(sourceDir, relPath),
|
|
2873
3240
|
relativePath: relPath,
|
|
2874
3241
|
type: "deleted",
|
|
2875
3242
|
currentHash: "",
|
|
@@ -2892,20 +3259,23 @@ function loadState(stateFilePath) {
|
|
|
2892
3259
|
}
|
|
2893
3260
|
}
|
|
2894
3261
|
function hashContent3(content) {
|
|
2895
|
-
return
|
|
3262
|
+
return crypto6.createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
2896
3263
|
}
|
|
2897
3264
|
|
|
2898
3265
|
// src/spaces/index.ts
|
|
2899
3266
|
import fs8 from "fs";
|
|
2900
|
-
import
|
|
2901
|
-
import
|
|
3267
|
+
import path11 from "path";
|
|
3268
|
+
import crypto7 from "crypto";
|
|
2902
3269
|
var MANIFEST_VERSION = 1;
|
|
3270
|
+
function normalizeSpaceMemoryDir(memoryDir) {
|
|
3271
|
+
return path11.resolve(memoryDir);
|
|
3272
|
+
}
|
|
2903
3273
|
function getSpacesDir(baseDir) {
|
|
2904
3274
|
const homeDir = baseDir ?? resolveHomeDir();
|
|
2905
|
-
return
|
|
3275
|
+
return path11.join(homeDir, ".config", "engram", "spaces");
|
|
2906
3276
|
}
|
|
2907
3277
|
function getManifestPath(baseDir) {
|
|
2908
|
-
return
|
|
3278
|
+
return path11.join(getSpacesDir(baseDir), "manifest.json");
|
|
2909
3279
|
}
|
|
2910
3280
|
function loadManifest(baseDir, memoryDirOverride) {
|
|
2911
3281
|
const manifestPath2 = getManifestPath(baseDir);
|
|
@@ -2924,21 +3294,22 @@ function loadManifest(baseDir, memoryDirOverride) {
|
|
|
2924
3294
|
}
|
|
2925
3295
|
function saveManifest(manifest, baseDir) {
|
|
2926
3296
|
const manifestPath2 = getManifestPath(baseDir);
|
|
2927
|
-
fs8.mkdirSync(
|
|
3297
|
+
fs8.mkdirSync(path11.dirname(manifestPath2), { recursive: true });
|
|
2928
3298
|
fs8.writeFileSync(manifestPath2, JSON.stringify(manifest, null, 2) + "\n");
|
|
2929
3299
|
}
|
|
2930
3300
|
function createPersonalSpace(baseDir, memoryDirOverride) {
|
|
2931
3301
|
const homeDir = baseDir ?? resolveHomeDir();
|
|
2932
|
-
const standalonePath =
|
|
2933
|
-
const openclawPath =
|
|
2934
|
-
const memoryDir = memoryDirOverride ?? readEnvVar("ENGRAM_MEMORY_DIR") ?? (fs8.existsSync(standalonePath) ? standalonePath : fs8.existsSync(openclawPath) ? openclawPath : standalonePath);
|
|
3302
|
+
const standalonePath = path11.join(homeDir, ".engram", "memory");
|
|
3303
|
+
const openclawPath = path11.join(homeDir, ".openclaw", "workspace", "memory", "local");
|
|
3304
|
+
const memoryDir = memoryDirOverride ?? readEnvVar("REMNIC_MEMORY_DIR") ?? readEnvVar("ENGRAM_MEMORY_DIR") ?? (fs8.existsSync(standalonePath) ? standalonePath : fs8.existsSync(openclawPath) ? openclawPath : standalonePath);
|
|
3305
|
+
const normalizedMemoryDir = normalizeSpaceMemoryDir(memoryDir);
|
|
2935
3306
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2936
3307
|
return {
|
|
2937
3308
|
id: "personal",
|
|
2938
3309
|
name: "Personal",
|
|
2939
3310
|
kind: "personal",
|
|
2940
3311
|
description: "Default personal memory space",
|
|
2941
|
-
memoryDir,
|
|
3312
|
+
memoryDir: normalizedMemoryDir,
|
|
2942
3313
|
createdAt: now,
|
|
2943
3314
|
updatedAt: now,
|
|
2944
3315
|
owner: readEnvVar("USER")
|
|
@@ -2964,10 +3335,12 @@ function createSpace(options) {
|
|
|
2964
3335
|
throw new Error(`Parent space "${options.parentSpaceId}" not found`);
|
|
2965
3336
|
}
|
|
2966
3337
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2967
|
-
const memoryDir =
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
3338
|
+
const memoryDir = normalizeSpaceMemoryDir(
|
|
3339
|
+
options.memoryDir ?? path11.join(
|
|
3340
|
+
getSpacesDir(options.baseDir),
|
|
3341
|
+
id,
|
|
3342
|
+
"memory"
|
|
3343
|
+
)
|
|
2971
3344
|
);
|
|
2972
3345
|
const space = {
|
|
2973
3346
|
id,
|
|
@@ -3154,16 +3527,16 @@ function mergeSpaces(sourceSpaceId, targetSpaceId, options) {
|
|
|
3154
3527
|
};
|
|
3155
3528
|
}
|
|
3156
3529
|
function getAuditLog(baseDir) {
|
|
3157
|
-
const auditPath =
|
|
3530
|
+
const auditPath = path11.join(getSpacesDir(baseDir), "audit.jsonl");
|
|
3158
3531
|
if (!fs8.existsSync(auditPath)) return [];
|
|
3159
3532
|
const lines = fs8.readFileSync(auditPath, "utf8").trim().split("\n");
|
|
3160
3533
|
return lines.filter((l) => l.trim()).map((l) => JSON.parse(l));
|
|
3161
3534
|
}
|
|
3162
3535
|
function appendAudit(entry, baseDir) {
|
|
3163
|
-
const auditPath =
|
|
3164
|
-
fs8.mkdirSync(
|
|
3536
|
+
const auditPath = path11.join(getSpacesDir(baseDir), "audit.jsonl");
|
|
3537
|
+
fs8.mkdirSync(path11.dirname(auditPath), { recursive: true });
|
|
3165
3538
|
const full = {
|
|
3166
|
-
id:
|
|
3539
|
+
id: crypto7.randomUUID(),
|
|
3167
3540
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3168
3541
|
...entry
|
|
3169
3542
|
};
|
|
@@ -3176,12 +3549,28 @@ function copyMemories(sourceDir, targetDir, options) {
|
|
|
3176
3549
|
if (!fs8.existsSync(sourceDir)) {
|
|
3177
3550
|
return { merged: 0, conflicts: [], skipped: 0 };
|
|
3178
3551
|
}
|
|
3552
|
+
const sourceRoot = fs8.realpathSync(sourceDir);
|
|
3179
3553
|
fs8.mkdirSync(targetDir, { recursive: true });
|
|
3180
|
-
const
|
|
3554
|
+
const targetRoot = fs8.realpathSync(targetDir);
|
|
3555
|
+
const sourceFiles = walkMd2(sourceRoot);
|
|
3181
3556
|
for (const sourcePath of sourceFiles) {
|
|
3557
|
+
const sourceRealPath = safeRealpath(sourcePath);
|
|
3558
|
+
if (!sourceRealPath || !isPathInsideRoot(sourceRealPath, sourceRoot)) {
|
|
3559
|
+
skipped++;
|
|
3560
|
+
continue;
|
|
3561
|
+
}
|
|
3562
|
+
const sourceStat = safeLstat(sourcePath);
|
|
3563
|
+
if (!sourceStat?.isFile()) {
|
|
3564
|
+
skipped++;
|
|
3565
|
+
continue;
|
|
3566
|
+
}
|
|
3182
3567
|
const content = fs8.readFileSync(sourcePath, "utf8");
|
|
3183
|
-
const relativePath =
|
|
3184
|
-
const targetPath =
|
|
3568
|
+
const relativePath = path11.relative(sourceRoot, sourceRealPath);
|
|
3569
|
+
const targetPath = path11.resolve(targetRoot, relativePath);
|
|
3570
|
+
if (!isPathInsideRoot(targetPath, targetRoot)) {
|
|
3571
|
+
skipped++;
|
|
3572
|
+
continue;
|
|
3573
|
+
}
|
|
3185
3574
|
const sourceHash = hashContent4(content);
|
|
3186
3575
|
if (options?.filterIds?.length) {
|
|
3187
3576
|
const fm = parseSimpleFrontmatter(content);
|
|
@@ -3190,6 +3579,18 @@ function copyMemories(sourceDir, targetDir, options) {
|
|
|
3190
3579
|
continue;
|
|
3191
3580
|
}
|
|
3192
3581
|
}
|
|
3582
|
+
if (fs8.existsSync(targetPath)) {
|
|
3583
|
+
const targetStat = safeLstat(targetPath);
|
|
3584
|
+
if (!targetStat?.isFile() || targetStat.isSymbolicLink()) {
|
|
3585
|
+
skipped++;
|
|
3586
|
+
continue;
|
|
3587
|
+
}
|
|
3588
|
+
const targetRealPath = safeRealpath(targetPath);
|
|
3589
|
+
if (!targetRealPath || !isPathInsideRoot(targetRealPath, targetRoot)) {
|
|
3590
|
+
skipped++;
|
|
3591
|
+
continue;
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3193
3594
|
if (fs8.existsSync(targetPath) && !options?.force) {
|
|
3194
3595
|
const targetContent = fs8.readFileSync(targetPath, "utf8");
|
|
3195
3596
|
const targetHash = hashContent4(targetContent);
|
|
@@ -3207,20 +3608,28 @@ function copyMemories(sourceDir, targetDir, options) {
|
|
|
3207
3608
|
skipped++;
|
|
3208
3609
|
continue;
|
|
3209
3610
|
}
|
|
3210
|
-
fs8.mkdirSync(
|
|
3611
|
+
fs8.mkdirSync(path11.dirname(targetPath), { recursive: true });
|
|
3612
|
+
const targetParentRealPath = safeRealpath(path11.dirname(targetPath));
|
|
3613
|
+
if (!targetParentRealPath || !isPathInsideRoot(targetParentRealPath, targetRoot)) {
|
|
3614
|
+
skipped++;
|
|
3615
|
+
continue;
|
|
3616
|
+
}
|
|
3211
3617
|
fs8.writeFileSync(targetPath, content);
|
|
3212
3618
|
merged++;
|
|
3213
3619
|
}
|
|
3214
3620
|
return { merged, conflicts, skipped };
|
|
3215
3621
|
}
|
|
3216
3622
|
function hashContent4(content) {
|
|
3217
|
-
return
|
|
3623
|
+
return crypto7.createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
3218
3624
|
}
|
|
3219
3625
|
function walkMd2(dir) {
|
|
3220
3626
|
const results = [];
|
|
3221
3627
|
function walk(d) {
|
|
3222
3628
|
for (const entry of fs8.readdirSync(d, { withFileTypes: true })) {
|
|
3223
|
-
const fullPath =
|
|
3629
|
+
const fullPath = path11.join(d, entry.name);
|
|
3630
|
+
if (entry.isSymbolicLink()) {
|
|
3631
|
+
continue;
|
|
3632
|
+
}
|
|
3224
3633
|
if (entry.isDirectory()) {
|
|
3225
3634
|
walk(fullPath);
|
|
3226
3635
|
} else if (entry.name.endsWith(".md")) {
|
|
@@ -3231,6 +3640,24 @@ function walkMd2(dir) {
|
|
|
3231
3640
|
walk(dir);
|
|
3232
3641
|
return results;
|
|
3233
3642
|
}
|
|
3643
|
+
function safeLstat(filePath) {
|
|
3644
|
+
try {
|
|
3645
|
+
return fs8.lstatSync(filePath);
|
|
3646
|
+
} catch {
|
|
3647
|
+
return null;
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3650
|
+
function safeRealpath(filePath) {
|
|
3651
|
+
try {
|
|
3652
|
+
return fs8.realpathSync(filePath);
|
|
3653
|
+
} catch {
|
|
3654
|
+
return null;
|
|
3655
|
+
}
|
|
3656
|
+
}
|
|
3657
|
+
function isPathInsideRoot(candidatePath, rootPath) {
|
|
3658
|
+
const relative = path11.relative(rootPath, candidatePath);
|
|
3659
|
+
return relative === "" || !relative.startsWith("..") && !path11.isAbsolute(relative);
|
|
3660
|
+
}
|
|
3234
3661
|
function parseSimpleFrontmatter(content) {
|
|
3235
3662
|
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
3236
3663
|
if (!match) return null;
|
|
@@ -3350,23 +3777,39 @@ var REMNIC_RECALL_DECISION_RULES = `## When to Use Recall vs Direct Read
|
|
|
3350
3777
|
// src/memory-extension/codex-publisher.ts
|
|
3351
3778
|
import fs9 from "fs";
|
|
3352
3779
|
import os from "os";
|
|
3353
|
-
import
|
|
3780
|
+
import path12 from "path";
|
|
3354
3781
|
var REMNIC_EXTENSION_DIR_NAME = "remnic";
|
|
3782
|
+
function resolveEnvHome(env) {
|
|
3783
|
+
if (env === void 0) return resolveHomeDir();
|
|
3784
|
+
return env.HOME?.trim() || env.USERPROFILE?.trim() || os.homedir();
|
|
3785
|
+
}
|
|
3786
|
+
function expandTildeWithHome(input, homeDir) {
|
|
3787
|
+
if (input === "~") return homeDir;
|
|
3788
|
+
if (input.startsWith("~/") || input.startsWith("~\\")) {
|
|
3789
|
+
return path12.join(homeDir, input.slice(2));
|
|
3790
|
+
}
|
|
3791
|
+
return input;
|
|
3792
|
+
}
|
|
3793
|
+
function normalizeHostRoot(input, homeDir) {
|
|
3794
|
+
return path12.resolve(expandTildeWithHome(input.trim(), homeDir));
|
|
3795
|
+
}
|
|
3355
3796
|
var CodexMemoryExtensionPublisher = class {
|
|
3356
3797
|
hostId = "codex";
|
|
3357
3798
|
static capabilities = {
|
|
3358
3799
|
instructionsMd: true,
|
|
3359
|
-
skillsFolder:
|
|
3800
|
+
skillsFolder: false,
|
|
3360
3801
|
citationFormat: true,
|
|
3361
3802
|
readPathTemplate: true
|
|
3362
3803
|
};
|
|
3363
3804
|
async resolveExtensionRoot(env) {
|
|
3364
|
-
const
|
|
3365
|
-
|
|
3805
|
+
const homeDir = resolveEnvHome(env);
|
|
3806
|
+
const codexHomeInput = env === void 0 ? readEnvVar("CODEX_HOME")?.trim() : env.CODEX_HOME?.trim();
|
|
3807
|
+
const codexHome = codexHomeInput ? normalizeHostRoot(codexHomeInput, homeDir) : path12.resolve(homeDir, ".codex");
|
|
3808
|
+
return path12.join(codexHome, "memories_extensions", REMNIC_EXTENSION_DIR_NAME);
|
|
3366
3809
|
}
|
|
3367
3810
|
async isHostAvailable() {
|
|
3368
3811
|
try {
|
|
3369
|
-
const home = readEnvVar("CODEX_HOME")?.trim() ||
|
|
3812
|
+
const home = readEnvVar("CODEX_HOME")?.trim() || path12.join(resolveHomeDir(), ".codex");
|
|
3370
3813
|
return fs9.existsSync(home);
|
|
3371
3814
|
} catch {
|
|
3372
3815
|
return false;
|
|
@@ -3417,7 +3860,7 @@ When running inside the Codex phase-2 consolidation sandbox:
|
|
|
3417
3860
|
}
|
|
3418
3861
|
async publish(ctx) {
|
|
3419
3862
|
const extensionRoot = await this.resolveExtensionRoot();
|
|
3420
|
-
const instructionsPath =
|
|
3863
|
+
const instructionsPath = path12.join(extensionRoot, "instructions.md");
|
|
3421
3864
|
const filesWritten = [];
|
|
3422
3865
|
const skipped = [];
|
|
3423
3866
|
ctx.log.info(`Publishing Codex memory extension to ${extensionRoot}`);
|
|
@@ -3532,141 +3975,21 @@ function publisherForConnector(connectorId) {
|
|
|
3532
3975
|
return publisherFor(hostIdForConnector(connectorId));
|
|
3533
3976
|
}
|
|
3534
3977
|
|
|
3535
|
-
// src/importers/base.ts
|
|
3536
|
-
var DEFAULT_IMPORT_BATCH_SIZE = 25;
|
|
3537
|
-
var MIN_IMPORT_BATCH_SIZE = 1;
|
|
3538
|
-
var MAX_IMPORT_BATCH_SIZE = 500;
|
|
3539
|
-
function validateImportBatchSize(value) {
|
|
3540
|
-
if (value === void 0) return DEFAULT_IMPORT_BATCH_SIZE;
|
|
3541
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
3542
|
-
throw new Error(
|
|
3543
|
-
`batchSize must be a finite number, received ${String(value)}`
|
|
3544
|
-
);
|
|
3545
|
-
}
|
|
3546
|
-
if (!Number.isInteger(value)) {
|
|
3547
|
-
throw new Error(`batchSize must be an integer, received ${value}`);
|
|
3548
|
-
}
|
|
3549
|
-
if (value < MIN_IMPORT_BATCH_SIZE || value > MAX_IMPORT_BATCH_SIZE) {
|
|
3550
|
-
throw new Error(
|
|
3551
|
-
`batchSize must be between ${MIN_IMPORT_BATCH_SIZE} and ${MAX_IMPORT_BATCH_SIZE}, received ${value}`
|
|
3552
|
-
);
|
|
3553
|
-
}
|
|
3554
|
-
return value;
|
|
3555
|
-
}
|
|
3556
|
-
function validateImportRateLimit(value) {
|
|
3557
|
-
if (value === void 0) return void 0;
|
|
3558
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
3559
|
-
throw new Error(
|
|
3560
|
-
`rateLimit must be a finite number (requests per second), received ${String(value)}`
|
|
3561
|
-
);
|
|
3562
|
-
}
|
|
3563
|
-
if (value <= 0) {
|
|
3564
|
-
throw new Error(
|
|
3565
|
-
`rateLimit must be greater than 0 (requests per second), received ${value}`
|
|
3566
|
-
);
|
|
3567
|
-
}
|
|
3568
|
-
return value;
|
|
3569
|
-
}
|
|
3570
|
-
function importedMemoryToTurn(memory) {
|
|
3571
|
-
const timestamp = typeof memory.sourceTimestamp === "string" && memory.sourceTimestamp.length > 0 ? memory.sourceTimestamp : memory.importedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
3572
|
-
return {
|
|
3573
|
-
role: "user",
|
|
3574
|
-
content: memory.content,
|
|
3575
|
-
timestamp,
|
|
3576
|
-
participantName: memory.sourceLabel,
|
|
3577
|
-
...memory.sourceId !== void 0 ? { participantId: memory.sourceId } : {}
|
|
3578
|
-
};
|
|
3579
|
-
}
|
|
3580
|
-
async function runImporter(adapter, input, target, options = {}) {
|
|
3581
|
-
const batchSize = validateImportBatchSize(options.batchSize);
|
|
3582
|
-
validateImportRateLimit(options.rateLimit);
|
|
3583
|
-
const importedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3584
|
-
const dryRun = options.dryRun === true;
|
|
3585
|
-
const onProgress = options.onProgress;
|
|
3586
|
-
onProgress?.({ processed: 0, total: 0, phase: "parse" });
|
|
3587
|
-
const parseOptions = {
|
|
3588
|
-
...options.rateLimit !== void 0 ? { rateLimit: options.rateLimit } : {},
|
|
3589
|
-
...options.parseOptions ?? {}
|
|
3590
|
-
};
|
|
3591
|
-
const parsed = await adapter.parse(input, parseOptions);
|
|
3592
|
-
onProgress?.({ processed: 0, total: 0, phase: "transform" });
|
|
3593
|
-
const memoriesRaw = await adapter.transform(parsed, options.transformOptions);
|
|
3594
|
-
if (!Array.isArray(memoriesRaw)) {
|
|
3595
|
-
throw new Error(
|
|
3596
|
-
`Importer '${adapter.name}' transform() returned a non-array. Adapters must produce ImportedMemory[].`
|
|
3597
|
-
);
|
|
3598
|
-
}
|
|
3599
|
-
const memories = memoriesRaw.map((memory) => {
|
|
3600
|
-
const sourceLabel = typeof memory.sourceLabel === "string" && memory.sourceLabel.length > 0 ? memory.sourceLabel : adapter.sourceLabel;
|
|
3601
|
-
return {
|
|
3602
|
-
...memory,
|
|
3603
|
-
sourceLabel,
|
|
3604
|
-
importedAt: memory.importedAt ?? importedAt
|
|
3605
|
-
};
|
|
3606
|
-
});
|
|
3607
|
-
if (dryRun) {
|
|
3608
|
-
onProgress?.({
|
|
3609
|
-
processed: memories.length,
|
|
3610
|
-
total: memories.length,
|
|
3611
|
-
phase: "dry-run"
|
|
3612
|
-
});
|
|
3613
|
-
return {
|
|
3614
|
-
adapter: adapter.name,
|
|
3615
|
-
sourceLabel: adapter.sourceLabel,
|
|
3616
|
-
memoriesPlanned: memories.length,
|
|
3617
|
-
memoriesWritten: 0,
|
|
3618
|
-
batchesProcessed: 0,
|
|
3619
|
-
dryRun: true,
|
|
3620
|
-
importedAt
|
|
3621
|
-
};
|
|
3622
|
-
}
|
|
3623
|
-
let batchesProcessed = 0;
|
|
3624
|
-
let memoriesWritten = 0;
|
|
3625
|
-
for (let i = 0; i < memories.length; i += batchSize) {
|
|
3626
|
-
const batch = memories.slice(i, i + batchSize);
|
|
3627
|
-
const result = await adapter.writeTo(target, batch, options);
|
|
3628
|
-
memoriesWritten += result.memoriesIngested;
|
|
3629
|
-
batchesProcessed += 1;
|
|
3630
|
-
onProgress?.({
|
|
3631
|
-
processed: Math.min(i + batch.length, memories.length),
|
|
3632
|
-
total: memories.length,
|
|
3633
|
-
phase: "write"
|
|
3634
|
-
});
|
|
3635
|
-
}
|
|
3636
|
-
return {
|
|
3637
|
-
adapter: adapter.name,
|
|
3638
|
-
sourceLabel: adapter.sourceLabel,
|
|
3639
|
-
memoriesPlanned: memories.length,
|
|
3640
|
-
memoriesWritten,
|
|
3641
|
-
batchesProcessed,
|
|
3642
|
-
dryRun: false,
|
|
3643
|
-
importedAt
|
|
3644
|
-
};
|
|
3645
|
-
}
|
|
3646
|
-
async function defaultWriteMemoriesToOrchestrator(target, memories) {
|
|
3647
|
-
if (memories.length === 0) {
|
|
3648
|
-
return { memoriesIngested: 0 };
|
|
3649
|
-
}
|
|
3650
|
-
const turns = memories.map(importedMemoryToTurn);
|
|
3651
|
-
await target.ingestBulkImportBatch(turns);
|
|
3652
|
-
return { memoriesIngested: memories.length };
|
|
3653
|
-
}
|
|
3654
|
-
|
|
3655
3978
|
// src/transfer/capsule-fork.ts
|
|
3656
3979
|
import { lstat, mkdir, readFile, realpath, writeFile } from "fs/promises";
|
|
3657
|
-
import
|
|
3980
|
+
import path13 from "path";
|
|
3658
3981
|
async function forkCapsule(opts) {
|
|
3659
3982
|
validateForkId(opts.forkId);
|
|
3660
|
-
const rootAbs =
|
|
3983
|
+
const rootAbs = path13.resolve(opts.targetRoot);
|
|
3661
3984
|
await assertIsDirectoryNotSymlink(rootAbs, "forkCapsule", "targetRoot");
|
|
3662
|
-
const forkDirAbs =
|
|
3985
|
+
const forkDirAbs = path13.join(rootAbs, "forks", opts.forkId);
|
|
3663
3986
|
const forkEntryExists = await pathEntryExists(forkDirAbs);
|
|
3664
3987
|
if (forkEntryExists) {
|
|
3665
3988
|
throw new Error(
|
|
3666
3989
|
`forkCapsule: fork path already exists \u2014 forkId "${opts.forkId}" is already in use at: ${forkDirAbs}`
|
|
3667
3990
|
);
|
|
3668
3991
|
}
|
|
3669
|
-
const archiveAbs =
|
|
3992
|
+
const archiveAbs = path13.resolve(opts.sourceArchive);
|
|
3670
3993
|
const importResult = await importCapsule({
|
|
3671
3994
|
archivePath: archiveAbs,
|
|
3672
3995
|
root: rootAbs,
|
|
@@ -3688,10 +4011,10 @@ async function forkCapsule(opts) {
|
|
|
3688
4011
|
importedRecords: importResult.imported.length,
|
|
3689
4012
|
skippedRecords: importResult.skipped.length
|
|
3690
4013
|
};
|
|
3691
|
-
const lineagePath =
|
|
4014
|
+
const lineagePath = path13.join(forkDirAbs, "lineage.json");
|
|
3692
4015
|
const rootReal = await realpath(rootAbs);
|
|
3693
4016
|
await assertRealpathInsideRoot(rootReal, lineagePath, `forks/${opts.forkId}/lineage.json`, "forkCapsule");
|
|
3694
|
-
await mkdir(
|
|
4017
|
+
await mkdir(path13.dirname(lineagePath), { recursive: true });
|
|
3695
4018
|
await writeFile(lineagePath, JSON.stringify(lineage, null, 2) + "\n", "utf-8");
|
|
3696
4019
|
return {
|
|
3697
4020
|
archivePath: archiveAbs,
|
|
@@ -3705,11 +4028,11 @@ async function readForkLineage(targetRoot, forkId) {
|
|
|
3705
4028
|
if (typeof forkId !== "string" || forkId.length === 0 || forkId.length > 64 || !CAPSULE_ID_PATTERN.test(forkId)) {
|
|
3706
4029
|
return null;
|
|
3707
4030
|
}
|
|
3708
|
-
const rootAbs =
|
|
4031
|
+
const rootAbs = path13.resolve(targetRoot);
|
|
3709
4032
|
const rootReal = await realpath(rootAbs).catch(() => rootAbs);
|
|
3710
|
-
const lineagePath =
|
|
3711
|
-
const rel =
|
|
3712
|
-
if (rel.startsWith("..") ||
|
|
4033
|
+
const lineagePath = path13.join(rootReal, "forks", forkId, "lineage.json");
|
|
4034
|
+
const rel = path13.relative(rootReal, lineagePath);
|
|
4035
|
+
if (rel.startsWith("..") || path13.isAbsolute(rel)) {
|
|
3713
4036
|
return null;
|
|
3714
4037
|
}
|
|
3715
4038
|
if (!await isLineagePathContained(rootReal, lineagePath)) {
|
|
@@ -3750,19 +4073,19 @@ async function pathEntryExists(absPath) {
|
|
|
3750
4073
|
async function isLineagePathContained(rootReal, lineagePath) {
|
|
3751
4074
|
let existing = lineagePath;
|
|
3752
4075
|
const suffix = [];
|
|
3753
|
-
while (existing !==
|
|
4076
|
+
while (existing !== path13.dirname(existing)) {
|
|
3754
4077
|
const st = await lstat(existing).catch(() => null);
|
|
3755
4078
|
if (st !== null) break;
|
|
3756
|
-
suffix.unshift(
|
|
3757
|
-
existing =
|
|
4079
|
+
suffix.unshift(path13.basename(existing));
|
|
4080
|
+
existing = path13.dirname(existing);
|
|
3758
4081
|
}
|
|
3759
4082
|
const existingReal = await realpath(existing).catch(() => existing);
|
|
3760
|
-
const targetReal = suffix.length > 0 ?
|
|
3761
|
-
const rel =
|
|
4083
|
+
const targetReal = suffix.length > 0 ? path13.join(existingReal, ...suffix) : existingReal;
|
|
4084
|
+
const rel = path13.relative(rootReal, targetReal);
|
|
3762
4085
|
if (rel === "") return true;
|
|
3763
4086
|
if (rel === "..") return false;
|
|
3764
|
-
if (rel.startsWith(`..${
|
|
3765
|
-
if (
|
|
4087
|
+
if (rel.startsWith(`..${path13.sep}`)) return false;
|
|
4088
|
+
if (path13.isAbsolute(rel)) return false;
|
|
3766
4089
|
return true;
|
|
3767
4090
|
}
|
|
3768
4091
|
export {
|
|
@@ -3809,7 +4132,6 @@ export {
|
|
|
3809
4132
|
GOOGLE_DRIVE_CURSOR_KIND,
|
|
3810
4133
|
DEFAULT_POLL_INTERVAL_MS as GOOGLE_DRIVE_DEFAULT_POLL_INTERVAL_MS,
|
|
3811
4134
|
HermesMemoryExtensionPublisher,
|
|
3812
|
-
LEGACY_PLUGIN_ID,
|
|
3813
4135
|
LanceDbBackend,
|
|
3814
4136
|
LiveConnectorRegistry,
|
|
3815
4137
|
LiveConnectorRegistryError,
|
|
@@ -3834,7 +4156,6 @@ export {
|
|
|
3834
4156
|
PEERS_DIR_NAME,
|
|
3835
4157
|
PEER_ID_MAX_LENGTH,
|
|
3836
4158
|
PEER_ID_PATTERN,
|
|
3837
|
-
PLUGIN_ID,
|
|
3838
4159
|
PUBLISHERS,
|
|
3839
4160
|
QmdClient,
|
|
3840
4161
|
RECALL_DISCLOSURE_LEVELS,
|
|
@@ -4115,6 +4436,7 @@ export {
|
|
|
4115
4436
|
reportBufferSurpriseDistribution,
|
|
4116
4437
|
resolveAgentAccessAuthToken,
|
|
4117
4438
|
resolveBriefingSaveDir,
|
|
4439
|
+
resolveBulkImportContext,
|
|
4118
4440
|
resolveCategory,
|
|
4119
4441
|
resolveCodingNamespaceOverlay,
|
|
4120
4442
|
resolveConnectorFromToken,
|
|
@@ -4122,8 +4444,8 @@ export {
|
|
|
4122
4444
|
resolveExtensionsRoot,
|
|
4123
4445
|
resolveGitContext,
|
|
4124
4446
|
resolvePair,
|
|
4447
|
+
resolvePluginEntry,
|
|
4125
4448
|
resolvePrincipal,
|
|
4126
|
-
resolveRemnicPluginEntry,
|
|
4127
4449
|
revertToVersion,
|
|
4128
4450
|
revokeToken,
|
|
4129
4451
|
rollbackFromEngramMigration,
|
|
@@ -4163,6 +4485,7 @@ export {
|
|
|
4163
4485
|
summarizeUserModelCoverage,
|
|
4164
4486
|
switchSpace,
|
|
4165
4487
|
syncChanges,
|
|
4488
|
+
validateBatchSize,
|
|
4166
4489
|
validateBriefingFormat,
|
|
4167
4490
|
validateGoogleDriveConfig,
|
|
4168
4491
|
validateImportBatchSize,
|