@remnic/core 1.1.12 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-cli.d.ts +2 -1
- package/dist/access-cli.js +263 -82
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +26 -60
- package/dist/access-http.js +43 -29
- package/dist/access-mcp.d.ts +24 -6
- package/dist/access-mcp.js +35 -28
- package/dist/access-schema.d.ts +9 -6
- package/dist/access-schema.js +7 -5
- package/dist/access-service-DcCDmNYC.d.ts +1542 -0
- package/dist/access-service.d.ts +25 -7
- package/dist/access-service.js +33 -26
- package/dist/active-memory-bridge.js +2 -2
- package/dist/active-recall.js +11 -3
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/claude-code.d.ts +24 -0
- package/dist/adapters/claude-code.js +9 -0
- package/dist/adapters/codex.d.ts +25 -0
- package/dist/adapters/codex.js +9 -0
- package/dist/adapters/hermes.d.ts +35 -0
- package/dist/adapters/hermes.js +9 -0
- package/dist/adapters/index.d.ts +6 -0
- package/dist/adapters/index.js +26 -0
- package/dist/adapters/registry.d.ts +20 -0
- package/dist/adapters/registry.js +13 -0
- package/dist/adapters/replit.d.ts +28 -0
- package/dist/adapters/replit.js +9 -0
- package/dist/adapters/types.d.ts +43 -0
- package/dist/adapters/types.js +8 -0
- package/dist/bootstrap.d.ts +20 -5
- package/dist/boxes.d.ts +7 -0
- package/dist/boxes.js +1 -1
- package/dist/briefing.d.ts +5 -3
- package/dist/briefing.js +9 -6
- package/dist/buffer-surprise-report.js +1 -1
- package/dist/buffer.d.ts +18 -4
- package/dist/buffer.js +1 -1
- package/dist/calibration.js +4 -4
- package/dist/capsule-cli.d.ts +4 -4
- package/dist/capsule-cli.js +1 -1
- package/dist/capsule-crypto-5CYAGVC5.js +18 -0
- package/dist/capsule-merge-4MGKE7C5.js +189 -0
- package/dist/causal-behavior.d.ts +8 -28
- package/dist/causal-behavior.js +6 -3
- package/dist/causal-behavior.js.map +1 -1
- package/dist/causal-chain.js +3 -2
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +24 -13
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +3 -3
- package/dist/causal-trajectory.js +1 -1
- package/dist/chunk-25MQ7IHJ.js +427 -0
- package/dist/chunk-25MQ7IHJ.js.map +1 -0
- package/dist/chunk-2F2W355T.js +256 -0
- package/dist/chunk-2F2W355T.js.map +1 -0
- package/dist/chunk-2KI4QFHU.js +228 -0
- package/dist/chunk-2KI4QFHU.js.map +1 -0
- package/dist/chunk-2PRQG7PV.js +86 -0
- package/dist/chunk-2PRQG7PV.js.map +1 -0
- package/dist/chunk-2QR3XXIC.js +2272 -0
- package/dist/chunk-2QR3XXIC.js.map +1 -0
- package/dist/chunk-2WWLHTZY.js +121 -0
- package/dist/chunk-326G7DJK.js +2185 -0
- package/dist/chunk-326G7DJK.js.map +1 -0
- package/dist/chunk-34DQE4KF.js +174 -0
- package/dist/chunk-34DQE4KF.js.map +1 -0
- package/dist/chunk-3APJ5EVB.js +601 -0
- package/dist/chunk-3APJ5EVB.js.map +1 -0
- package/dist/chunk-3HPAPHUK.js +51 -0
- package/dist/chunk-3HPAPHUK.js.map +1 -0
- package/dist/chunk-3JXBXXM2.js +69 -0
- package/dist/chunk-3JXBXXM2.js.map +1 -0
- package/dist/chunk-3KW65B36.js +681 -0
- package/dist/chunk-3KW65B36.js.map +1 -0
- package/dist/chunk-3UXOZBHV.js +20 -0
- package/dist/chunk-3UXOZBHV.js.map +1 -0
- package/dist/chunk-3VAL7ZL2.js +266 -0
- package/dist/chunk-3VAL7ZL2.js.map +1 -0
- package/dist/chunk-3Y4P7RXM.js +31 -0
- package/dist/chunk-3Y4P7RXM.js.map +1 -0
- package/dist/chunk-47VWKCAF.js +273 -0
- package/dist/chunk-47VWKCAF.js.map +1 -0
- package/dist/chunk-4CRG46BG.js +271 -0
- package/dist/chunk-5375UYTQ.js +914 -0
- package/dist/chunk-5375UYTQ.js.map +1 -0
- package/dist/chunk-56K5QLHX.js +506 -0
- package/dist/chunk-56K5QLHX.js.map +1 -0
- package/dist/chunk-5RGLBDQF.js +596 -0
- package/dist/chunk-5RGLBDQF.js.map +1 -0
- package/dist/chunk-5UZXUTVO.js +9 -0
- package/dist/chunk-5UZXUTVO.js.map +1 -0
- package/dist/chunk-65PG43EQ.js +105 -0
- package/dist/chunk-65PG43EQ.js.map +1 -0
- package/dist/chunk-66DHUKLO.js +57 -0
- package/dist/chunk-66DHUKLO.js.map +1 -0
- package/dist/chunk-6FC5EGNV.js +46 -0
- package/dist/chunk-6FC5EGNV.js.map +1 -0
- package/dist/chunk-6H2TESSP.js +62 -0
- package/dist/chunk-6H2TESSP.js.map +1 -0
- package/dist/chunk-6LVVDPJ4.js +32 -0
- package/dist/chunk-6LVVDPJ4.js.map +1 -0
- package/dist/chunk-6RVI47ZR.js +159 -0
- package/dist/chunk-6RVI47ZR.js.map +1 -0
- package/dist/chunk-7AAT6G4Q.js +5117 -0
- package/dist/chunk-7AAT6G4Q.js.map +1 -0
- package/dist/chunk-7DTASS5T.js +29 -0
- package/dist/chunk-7DTASS5T.js.map +1 -0
- package/dist/chunk-7IASACLB.js +596 -0
- package/dist/chunk-7MNMYOFP.js +32 -0
- package/dist/chunk-7MNMYOFP.js.map +1 -0
- package/dist/chunk-7N4KAIGN.js +133 -0
- package/dist/chunk-7N4KAIGN.js.map +1 -0
- package/dist/chunk-7OZ53EXP.js +101 -0
- package/dist/chunk-7OZ53EXP.js.map +1 -0
- package/dist/chunk-7XYTQGCC.js +134 -0
- package/dist/chunk-7XYTQGCC.js.map +1 -0
- package/dist/chunk-A2XUIMJ3.js +341 -0
- package/dist/chunk-A2XUIMJ3.js.map +1 -0
- package/dist/chunk-AGZQD76C.js +201 -0
- package/dist/chunk-AGZQD76C.js.map +1 -0
- package/dist/chunk-APO3DCMU.js +361 -0
- package/dist/chunk-APO3DCMU.js.map +1 -0
- package/dist/chunk-BFBF3XEF.js +283 -0
- package/dist/chunk-BFBF3XEF.js.map +1 -0
- package/dist/chunk-BJ3KMYTB.js +1974 -0
- package/dist/chunk-BJ3KMYTB.js.map +1 -0
- package/dist/chunk-CHEL3SKB.js +6758 -0
- package/dist/chunk-CHEL3SKB.js.map +1 -0
- package/dist/chunk-CQZRLNMV.js +1491 -0
- package/dist/chunk-CQZRLNMV.js.map +1 -0
- package/dist/chunk-D46YSIYX.js +892 -0
- package/dist/chunk-D46YSIYX.js.map +1 -0
- package/dist/chunk-DINWEURR.js +648 -0
- package/dist/chunk-DINWEURR.js.map +1 -0
- package/dist/chunk-DK5LDEQM.js +530 -0
- package/dist/chunk-DK5LDEQM.js.map +1 -0
- package/dist/chunk-DOM4GKSW.js +34 -0
- package/dist/chunk-DOM4GKSW.js.map +1 -0
- package/dist/chunk-EDTHC6UD.js +1075 -0
- package/dist/chunk-EFJ3MQ4V.js +721 -0
- package/dist/chunk-EHRTFRWW.js +89 -0
- package/dist/chunk-EHRTFRWW.js.map +1 -0
- package/dist/chunk-FAJ7FZYM.js +11 -0
- package/dist/chunk-FAJ7FZYM.js.map +1 -0
- package/dist/chunk-FBYESMQ2.js +570 -0
- package/dist/chunk-FDU6HUUL.js +147 -0
- package/dist/chunk-FF4KLI5W.js +99 -0
- package/dist/chunk-FF4KLI5W.js.map +1 -0
- package/dist/chunk-FIT6DMX6.js +310 -0
- package/dist/chunk-FIT6DMX6.js.map +1 -0
- package/dist/chunk-FJ43PRLT.js +272 -0
- package/dist/chunk-FJ43PRLT.js.map +1 -0
- package/dist/chunk-FKFMOY3N.js +32 -0
- package/dist/chunk-FKFMOY3N.js.map +1 -0
- package/dist/chunk-FLTNHQK6.js +262 -0
- package/dist/chunk-FLTNHQK6.js.map +1 -0
- package/dist/chunk-GA454ALV.js +12436 -0
- package/dist/chunk-GA454ALV.js.map +1 -0
- package/dist/chunk-GGKRUQOO.js +228 -0
- package/dist/chunk-GIF42EW3.js +63 -0
- package/dist/chunk-GIF42EW3.js.map +1 -0
- package/dist/chunk-GL6I6MEQ.js +647 -0
- package/dist/chunk-H3ME6L6D.js +709 -0
- package/dist/chunk-H3ME6L6D.js.map +1 -0
- package/dist/chunk-HHLLAQGZ.js +1 -0
- package/dist/chunk-HXXBL2KD.js +2040 -0
- package/dist/chunk-I5V2VDIW.js +219 -0
- package/dist/chunk-I5V2VDIW.js.map +1 -0
- package/dist/chunk-I6K5FBRQ.js +35 -0
- package/dist/chunk-I6K5FBRQ.js.map +1 -0
- package/dist/chunk-ICRIXAP2.js +121 -0
- package/dist/chunk-ICRIXAP2.js.map +1 -0
- package/dist/chunk-J4EB7DNW.js +11 -0
- package/dist/chunk-J4EB7DNW.js.map +1 -0
- package/dist/chunk-JLFA7DQG.js +62 -0
- package/dist/chunk-JLFA7DQG.js.map +1 -0
- package/dist/chunk-KJTKLXTH.js +9 -0
- package/dist/chunk-KJTKLXTH.js.map +1 -0
- package/dist/chunk-KLAO5DGL.js +917 -0
- package/dist/chunk-KLAO5DGL.js.map +1 -0
- package/dist/chunk-KNKUID7G.js +183 -0
- package/dist/chunk-KOSORCJG.js +624 -0
- package/dist/chunk-KOSORCJG.js.map +1 -0
- package/dist/chunk-KUJVMMZQ.js +1262 -0
- package/dist/chunk-KUJVMMZQ.js.map +1 -0
- package/dist/chunk-LCR46JY5.js +123 -0
- package/dist/chunk-LCR46JY5.js.map +1 -0
- package/dist/chunk-LLQ2LLWF.js +148 -0
- package/dist/chunk-LLQ2LLWF.js.map +1 -0
- package/dist/chunk-LPMVBPA3.js +236 -0
- package/dist/chunk-LT3NLYSI.js +50 -0
- package/dist/chunk-LT3NLYSI.js.map +1 -0
- package/dist/chunk-LUDTDZLK.js +287 -0
- package/dist/chunk-LUDTDZLK.js.map +1 -0
- package/dist/chunk-M23FSH32.js +3963 -0
- package/dist/chunk-M23FSH32.js.map +1 -0
- package/dist/chunk-MC26UJIM.js +118 -0
- package/dist/chunk-ME6ESPZU.js +119 -0
- package/dist/chunk-ME6ESPZU.js.map +1 -0
- package/dist/chunk-MGKYQQYF.js +272 -0
- package/dist/chunk-MJFNCJXV.js +66 -0
- package/dist/chunk-MJFNCJXV.js.map +1 -0
- package/dist/chunk-MSWG7JI6.js +237 -0
- package/dist/chunk-MSWG7JI6.js.map +1 -0
- package/dist/chunk-MT25YHYH.js +141 -0
- package/dist/chunk-MT25YHYH.js.map +1 -0
- package/dist/chunk-MT4HVDUZ.js +53 -0
- package/dist/chunk-MY6TPVXW.js +219 -0
- package/dist/chunk-N2D6GXBM.js +267 -0
- package/dist/chunk-N2D6GXBM.js.map +1 -0
- package/dist/chunk-NJ3MJQZX.js +46 -0
- package/dist/chunk-NJ3MJQZX.js.map +1 -0
- package/dist/chunk-NMZY542O.js +335 -0
- package/dist/chunk-NMZY542O.js.map +1 -0
- package/dist/chunk-NNVTUXEB.js +23 -0
- package/dist/chunk-NZL6GGQE.js +375 -0
- package/dist/chunk-NZL6GGQE.js.map +1 -0
- package/dist/chunk-P4NEIHUT.js +108 -0
- package/dist/chunk-P7FMDTKL.js +103 -0
- package/dist/chunk-P7FMDTKL.js.map +1 -0
- package/dist/chunk-PHK3HARR.js +32 -0
- package/dist/chunk-PHK3HARR.js.map +1 -0
- package/dist/chunk-PIRJPV5T.js +98 -0
- package/dist/chunk-PIRJPV5T.js.map +1 -0
- package/dist/chunk-PK7H5L6Y.js +159 -0
- package/dist/chunk-PK7H5L6Y.js.map +1 -0
- package/dist/chunk-PR5FBTFU.js +233 -0
- package/dist/chunk-PR5FBTFU.js.map +1 -0
- package/dist/chunk-PU63GXWS.js +174 -0
- package/dist/chunk-PU63GXWS.js.map +1 -0
- package/dist/chunk-PZIAX57I.js +124 -0
- package/dist/chunk-PZIAX57I.js.map +1 -0
- package/dist/chunk-Q7P4WJDP.js +26 -0
- package/dist/chunk-Q7P4WJDP.js.map +1 -0
- package/dist/chunk-QQUAB63I.js +63 -0
- package/dist/chunk-QQUAB63I.js.map +1 -0
- package/dist/chunk-QRNI5JBH.js +18 -0
- package/dist/chunk-RHY3HH7P.js +601 -0
- package/dist/chunk-RHY3HH7P.js.map +1 -0
- package/dist/chunk-RRF5UOBJ.js +91 -0
- package/dist/chunk-RXDLTSWT.js +124 -0
- package/dist/chunk-RXDLTSWT.js.map +1 -0
- package/dist/chunk-RYED3SPJ.js +42 -0
- package/dist/chunk-RYED3SPJ.js.map +1 -0
- package/dist/chunk-S7KDBTWT.js +106 -0
- package/dist/chunk-S7KDBTWT.js.map +1 -0
- package/dist/chunk-SEDEKFYQ.js +1 -0
- package/dist/chunk-TECVW3JP.js +36 -0
- package/dist/chunk-TECVW3JP.js.map +1 -0
- package/dist/chunk-TFO23QT4.js +88 -0
- package/dist/chunk-TFO23QT4.js.map +1 -0
- package/dist/chunk-TK4UEOSK.js +76 -0
- package/dist/chunk-TK4UEOSK.js.map +1 -0
- package/dist/chunk-TKWGAOLV.js +122 -0
- package/dist/chunk-TKWGAOLV.js.map +1 -0
- package/dist/chunk-TMM4S4IJ.js +597 -0
- package/dist/chunk-TMM4S4IJ.js.map +1 -0
- package/dist/chunk-TMQLARTH.js +188 -0
- package/dist/chunk-TMQLARTH.js.map +1 -0
- package/dist/chunk-TPDBFYEG.js +130 -0
- package/dist/chunk-TPDBFYEG.js.map +1 -0
- package/dist/chunk-TPMQ3G6Z.js +145 -0
- package/dist/chunk-TPMQ3G6Z.js.map +1 -0
- package/dist/chunk-TZOLIGIG.js +61 -0
- package/dist/chunk-TZOLIGIG.js.map +1 -0
- package/dist/chunk-U3PN77QT.js +113 -0
- package/dist/chunk-U3WSW6PZ.js +277 -0
- package/dist/chunk-U4SCL7B7.js +640 -0
- package/dist/chunk-U4SCL7B7.js.map +1 -0
- package/dist/chunk-UWK5OXUJ.js +156 -0
- package/dist/chunk-UWK5OXUJ.js.map +1 -0
- package/dist/chunk-UWVJF25J.js +74 -0
- package/dist/chunk-UXHQAFNA.js +1317 -0
- package/dist/chunk-UXHQAFNA.js.map +1 -0
- package/dist/chunk-V5OCT34X.js +1 -0
- package/dist/chunk-VLXA6PI2.js +304 -0
- package/dist/chunk-VLXA6PI2.js.map +1 -0
- package/dist/chunk-VNO6ZJ35.js +500 -0
- package/dist/chunk-VNO6ZJ35.js.map +1 -0
- package/dist/chunk-VW676BEI.js +827 -0
- package/dist/chunk-VW676BEI.js.map +1 -0
- package/dist/chunk-W3LR522O.js +2296 -0
- package/dist/chunk-W4L6CZKA.js +96 -0
- package/dist/chunk-W4L6CZKA.js.map +1 -0
- package/dist/chunk-W4RVMTHR.js +372 -0
- package/dist/chunk-W4RVMTHR.js.map +1 -0
- package/dist/chunk-WEHSQBFR.js +188 -0
- package/dist/chunk-WEHSQBFR.js.map +1 -0
- package/dist/chunk-WELDCG6C.js +380 -0
- package/dist/chunk-WELDCG6C.js.map +1 -0
- package/dist/chunk-WZYKANL3.js +2800 -0
- package/dist/chunk-WZYKANL3.js.map +1 -0
- package/dist/chunk-XIG5PDM7.js +48 -0
- package/dist/chunk-XJNBEDFE.js +193 -0
- package/dist/chunk-XJNBEDFE.js.map +1 -0
- package/dist/chunk-XVVIG67A.js +291 -0
- package/dist/chunk-XVVIG67A.js.map +1 -0
- package/dist/chunk-XVZ7B3HG.js +135 -0
- package/dist/chunk-YBPYIAA5.js +73 -0
- package/dist/chunk-YBPYIAA5.js.map +1 -0
- package/dist/chunk-Z734BLO3.js +21 -0
- package/dist/chunk-Z734BLO3.js.map +1 -0
- package/dist/chunk-ZKSK55RC.js +269 -0
- package/dist/chunk-ZKSK55RC.js.map +1 -0
- package/dist/chunk-ZTFCYYEZ.js +69 -0
- package/dist/chunk-ZTFCYYEZ.js.map +1 -0
- package/dist/chunk-ZY2MNJR6.js +329 -0
- package/dist/chunk-ZY2MNJR6.js.map +1 -0
- package/dist/cli-D3VpkVwB.d.ts +1136 -0
- package/dist/cli.d.ts +39 -10
- package/dist/cli.js +108 -49
- package/dist/commitment-ledger.js +1 -1
- package/dist/compat/checks.d.ts +5 -0
- package/dist/compat/checks.js +11 -0
- package/dist/compat/checks.js.map +1 -0
- package/dist/compat/types.d.ts +30 -0
- package/dist/compat/types.js +1 -0
- package/dist/compat/types.js.map +1 -0
- package/dist/compounding/engine.d.ts +221 -0
- package/dist/compounding/engine.js +32 -0
- package/dist/compounding/engine.js.map +1 -0
- package/dist/compounding/preference-consolidator.d.ts +92 -0
- package/dist/compounding/preference-consolidator.js +553 -0
- package/dist/compounding/preference-consolidator.js.map +1 -0
- package/dist/config.d.ts +4 -2
- package/dist/config.js +9 -4
- package/dist/conflict-policy-DyJ2wd-h.d.ts +4 -0
- package/dist/connectors/codex-materialize-runner.d.ts +64 -0
- package/dist/connectors/codex-materialize-runner.js +33 -0
- package/dist/connectors/codex-materialize-runner.js.map +1 -0
- package/dist/connectors/codex-materialize.d.ts +195 -0
- package/dist/connectors/codex-materialize.js +38 -0
- package/dist/connectors/codex-materialize.js.map +1 -0
- package/dist/connectors/index.d.ts +444 -0
- package/dist/connectors/index.js +115 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/connectors-cli-CwbyjGR7.d.ts +257 -0
- package/dist/connectors-cli.d.ts +1 -1
- package/dist/consolidation-provenance-check.d.ts +3 -1
- package/dist/consolidation-undo.d.ts +3 -1
- package/dist/contradiction/index.d.ts +258 -0
- package/dist/contradiction/index.js +43 -0
- package/dist/contradiction/index.js.map +1 -0
- package/dist/contradiction-review-ATP4S6IC.js +30 -0
- package/dist/contradiction-review-ATP4S6IC.js.map +1 -0
- package/dist/contradiction-scan-5A4IDZV5.js +13 -0
- package/dist/contradiction-scan-5A4IDZV5.js.map +1 -0
- package/dist/conversation-index/backend.d.ts +97 -0
- package/dist/conversation-index/backend.js +13 -0
- package/dist/conversation-index/backend.js.map +1 -0
- package/dist/conversation-index/chunker.d.ts +16 -0
- package/dist/conversation-index/chunker.js +8 -0
- package/dist/conversation-index/chunker.js.map +1 -0
- package/dist/conversation-index/cleanup.d.ts +11 -0
- package/dist/conversation-index/cleanup.js +9 -0
- package/dist/conversation-index/cleanup.js.map +1 -0
- package/dist/conversation-index/faiss-adapter.d.ts +6 -0
- package/dist/conversation-index/faiss-adapter.js +16 -0
- package/dist/conversation-index/faiss-adapter.js.map +1 -0
- package/dist/conversation-index/indexer.d.ts +23 -0
- package/dist/conversation-index/indexer.js +15 -0
- package/dist/conversation-index/indexer.js.map +1 -0
- package/dist/conversation-index/search.d.ts +6 -0
- package/dist/conversation-index/search.js +11 -0
- package/dist/conversation-index/search.js.map +1 -0
- package/dist/embedding-fallback.js +2 -2
- package/dist/enrichment/index.d.ts +163 -0
- package/dist/enrichment/index.js +18 -0
- package/dist/enrichment/index.js.map +1 -0
- package/dist/entity-retrieval.d.ts +4 -2
- package/dist/entity-retrieval.js +8 -5
- package/dist/evals.js +1 -1
- package/dist/explicit-capture.d.ts +20 -5
- package/dist/explicit-capture.js +2 -2
- package/dist/extraction-judge-training.js +1 -1
- package/dist/extraction.js +8 -8
- package/dist/faiss-adapter-CzPghc4C.d.ts +70 -0
- package/dist/fallback-llm.d.ts +2 -0
- package/dist/fallback-llm.js +4 -4
- package/dist/graph-edge-decay-5DI5GUNL.js +207 -0
- package/dist/index.d.ts +66 -711
- package/dist/index.js +556 -2680
- package/dist/index.js.map +1 -1
- package/dist/lcm/archive.d.ts +89 -0
- package/dist/lcm/archive.js +12 -0
- package/dist/lcm/archive.js.map +1 -0
- package/dist/lcm/dag.d.ts +48 -0
- package/dist/lcm/dag.js +8 -0
- package/dist/lcm/dag.js.map +1 -0
- package/dist/lcm/engine.d.ts +116 -0
- package/dist/lcm/engine.js +20 -0
- package/dist/lcm/engine.js.map +1 -0
- package/dist/lcm/index.d.ts +12 -0
- package/dist/lcm/index.js +44 -0
- package/dist/lcm/index.js.map +1 -0
- package/dist/lcm/queue.d.ts +62 -0
- package/dist/lcm/queue.js +8 -0
- package/dist/lcm/queue.js.map +1 -0
- package/dist/lcm/recall.d.ts +20 -0
- package/dist/lcm/recall.js +8 -0
- package/dist/lcm/recall.js.map +1 -0
- package/dist/lcm/schema.d.ts +16 -0
- package/dist/lcm/schema.js +14 -0
- package/dist/lcm/schema.js.map +1 -0
- package/dist/lcm/summarizer.d.ts +38 -0
- package/dist/lcm/summarizer.js +12 -0
- package/dist/lcm/summarizer.js.map +1 -0
- package/dist/lcm/tools.d.ts +29 -0
- package/dist/lcm/tools.js +8 -0
- package/dist/lcm/tools.js.map +1 -0
- package/dist/live-connectors-runner.js +5 -5
- package/dist/local-llm.js +3 -3
- package/dist/maintenance/archive-observations.d.ts +18 -0
- package/dist/maintenance/archive-observations.js +8 -0
- package/dist/maintenance/archive-observations.js.map +1 -0
- package/dist/maintenance/backup-stamp.d.ts +3 -0
- package/dist/maintenance/backup-stamp.js +8 -0
- package/dist/maintenance/backup-stamp.js.map +1 -0
- package/dist/maintenance/memory-governance-cron.d.ts +85 -0
- package/dist/maintenance/memory-governance-cron.js +22 -0
- package/dist/maintenance/memory-governance-cron.js.map +1 -0
- package/dist/maintenance/memory-governance.d.ts +137 -0
- package/dist/maintenance/memory-governance.js +40 -0
- package/dist/maintenance/memory-governance.js.map +1 -0
- package/dist/maintenance/migrate-observations.d.ts +18 -0
- package/dist/maintenance/migrate-observations.js +9 -0
- package/dist/maintenance/migrate-observations.js.map +1 -0
- package/dist/maintenance/observation-ledger-utils.d.ts +10 -0
- package/dist/maintenance/observation-ledger-utils.js +10 -0
- package/dist/maintenance/observation-ledger-utils.js.map +1 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +15 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +28 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js.map +1 -0
- package/dist/maintenance/rebuild-memory-projection.d.ts +77 -0
- package/dist/maintenance/rebuild-memory-projection.js +35 -0
- package/dist/maintenance/rebuild-memory-projection.js.map +1 -0
- package/dist/maintenance/rebuild-observations.d.ts +17 -0
- package/dist/maintenance/rebuild-observations.js +9 -0
- package/dist/maintenance/rebuild-observations.js.map +1 -0
- package/dist/mcp-memory-inspector-app.d.ts +24 -6
- package/dist/memory-projection-store.d.ts +108 -3
- package/dist/memory-projection-store.js +2 -1
- package/dist/memory-worth-outcomes.d.ts +4 -2
- package/dist/migrate/from-engram.d.ts +24 -0
- package/dist/migrate/from-engram.js +12 -0
- package/dist/migrate/from-engram.js.map +1 -0
- package/dist/namespaces/migrate.d.ts +50 -0
- package/dist/namespaces/migrate.js +50 -0
- package/dist/namespaces/migrate.js.map +1 -0
- package/dist/namespaces/principal.d.ts +17 -0
- package/dist/namespaces/principal.js +16 -0
- package/dist/namespaces/principal.js.map +1 -0
- package/dist/namespaces/search.d.ts +46 -0
- package/dist/namespaces/search.js +28 -0
- package/dist/namespaces/search.js.map +1 -0
- package/dist/namespaces/storage.d.ts +32 -0
- package/dist/namespaces/storage.js +28 -0
- package/dist/namespaces/storage.js.map +1 -0
- package/dist/network/tailscale.d.ts +41 -0
- package/dist/network/tailscale.js +9 -0
- package/dist/network/tailscale.js.map +1 -0
- package/dist/network/webdav.d.ts +39 -0
- package/dist/network/webdav.js +10 -0
- package/dist/network/webdav.js.map +1 -0
- package/dist/objective-state-writers.js +2 -2
- package/dist/operator-toolkit.d.ts +4 -2
- package/dist/operator-toolkit.js +32 -14
- package/dist/opik-exporter.js +2 -2
- package/dist/opik-exporter.js.map +1 -1
- package/dist/orchestrator-DuWl9Hwx.d.ts +1244 -0
- package/dist/orchestrator.d.ts +22 -7
- package/dist/orchestrator.js +79 -44
- package/dist/path-MR5JPYOP.js +9 -0
- package/dist/path-MR5JPYOP.js.map +1 -0
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +102 -3
- package/dist/qmd.js +23 -5
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.js +2 -2
- package/dist/replay/normalizers/chatgpt.d.ts +6 -0
- package/dist/replay/normalizers/chatgpt.js +11 -0
- package/dist/replay/normalizers/chatgpt.js.map +1 -0
- package/dist/replay/normalizers/claude.d.ts +6 -0
- package/dist/replay/normalizers/claude.js +11 -0
- package/dist/replay/normalizers/claude.js.map +1 -0
- package/dist/replay/normalizers/openclaw.d.ts +6 -0
- package/dist/replay/normalizers/openclaw.js +11 -0
- package/dist/replay/normalizers/openclaw.js.map +1 -0
- package/dist/replay/normalizers/shared.d.ts +16 -0
- package/dist/replay/normalizers/shared.js +14 -0
- package/dist/replay/normalizers/shared.js.map +1 -0
- package/dist/replay/runner.d.ts +35 -0
- package/dist/replay/runner.js +16 -0
- package/dist/replay/runner.js.map +1 -0
- package/dist/replay/types.d.ts +57 -0
- package/dist/replay/types.js +19 -0
- package/dist/replay/types.js.map +1 -0
- package/dist/resolution-B7FNQSSP.js +12 -0
- package/dist/resolution-B7FNQSSP.js.map +1 -0
- package/dist/resolve-provider-secret.js +2 -2
- package/dist/resume-bundles.js +8 -6
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/routing/engine.d.ts +35 -0
- package/dist/routing/engine.js +16 -0
- package/dist/routing/engine.js.map +1 -0
- package/dist/routing/store.d.ts +27 -0
- package/dist/routing/store.js +10 -0
- package/dist/routing/store.js.map +1 -0
- package/dist/runtime/better-sqlite.d.ts +8 -0
- package/dist/runtime/better-sqlite.js +10 -0
- package/dist/runtime/better-sqlite.js.map +1 -0
- package/dist/runtime/child-process.d.ts +32 -0
- package/dist/runtime/child-process.js +10 -0
- package/dist/runtime/child-process.js.map +1 -0
- package/dist/runtime/env.d.ts +5 -0
- package/dist/runtime/env.js +12 -0
- package/dist/runtime/env.js.map +1 -0
- package/dist/schemas.d.ts +22 -22
- package/dist/sdk-compat.js +1 -1
- package/dist/search/document-scanner.d.ts +22 -0
- package/dist/search/document-scanner.js +8 -0
- package/dist/search/document-scanner.js.map +1 -0
- package/dist/search/embed-helper.d.ts +35 -0
- package/dist/search/embed-helper.js +9 -0
- package/dist/search/embed-helper.js.map +1 -0
- package/dist/search/factory.d.ts +32 -0
- package/dist/search/factory.js +29 -0
- package/dist/search/factory.js.map +1 -0
- package/dist/search/index.d.ts +15 -0
- package/dist/search/index.js +50 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/lancedb-backend.d.ts +51 -0
- package/dist/search/lancedb-backend.js +10 -0
- package/dist/search/lancedb-backend.js.map +1 -0
- package/dist/search/meilisearch-backend.d.ts +48 -0
- package/dist/search/meilisearch-backend.js +10 -0
- package/dist/search/meilisearch-backend.js.map +1 -0
- package/dist/search/noop-backend.d.ts +26 -0
- package/dist/search/noop-backend.js +8 -0
- package/dist/search/noop-backend.js.map +1 -0
- package/dist/search/orama-backend.d.ts +53 -0
- package/dist/search/orama-backend.js +10 -0
- package/dist/search/orama-backend.js.map +1 -0
- package/dist/search/port.d.ts +61 -0
- package/dist/search/port.js +1 -0
- package/dist/search/port.js.map +1 -0
- package/dist/search/remote-backend.d.ts +39 -0
- package/dist/search/remote-backend.js +9 -0
- package/dist/search/remote-backend.js.map +1 -0
- package/dist/secure-store/index.d.ts +890 -0
- package/dist/secure-store/index.js +156 -0
- package/dist/secure-store/index.js.map +1 -0
- package/dist/semantic-VwGI14Ok.d.ts +69 -0
- package/dist/semantic-consolidation-4HkHWgeI.d.ts +180 -0
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +13 -6
- package/dist/semantic-rule-promotion.js +8 -5
- package/dist/semantic-rule-verifier.js +8 -5
- package/dist/shared-context/manager.d.ts +131 -0
- package/dist/shared-context/manager.js +15 -0
- package/dist/shared-context/manager.js.map +1 -0
- package/dist/skills-registry.js +13 -1
- package/dist/skills-registry.js.map +1 -1
- package/dist/state-store-VZU2IA53.js +16 -0
- package/dist/state-store-VZU2IA53.js.map +1 -0
- package/dist/storage-paths.d.ts +9 -0
- package/dist/storage-paths.js +20 -0
- package/dist/storage-paths.js.map +1 -0
- package/dist/storage.d.ts +3 -1
- package/dist/storage.js +7 -4
- package/dist/summarizer.d.ts +5 -0
- package/dist/summarizer.js +9 -8
- package/dist/summary-snapshot.js +2 -1
- package/dist/surfaces/dreams.d.ts +16 -0
- package/dist/surfaces/dreams.js +282 -0
- package/dist/surfaces/dreams.js.map +1 -0
- package/dist/surfaces/heartbeat.d.ts +17 -0
- package/dist/surfaces/heartbeat.js +265 -0
- package/dist/surfaces/heartbeat.js.map +1 -0
- package/dist/temporal-supersession.d.ts +3 -1
- package/dist/threading.d.ts +5 -0
- package/dist/threading.js +2 -1
- package/dist/tier-migration.d.ts +4 -2
- package/dist/tokens.js +2 -2
- package/dist/transcript.d.ts +15 -1
- package/dist/transcript.js +2 -1
- package/dist/transfer/autodetect.d.ts +4 -0
- package/dist/transfer/autodetect.js +15 -0
- package/dist/transfer/autodetect.js.map +1 -0
- package/dist/transfer/backup.d.ts +21 -0
- package/dist/transfer/backup.js +17 -0
- package/dist/transfer/backup.js.map +1 -0
- package/dist/transfer/capsule-export.d.ts +113 -0
- package/dist/transfer/capsule-export.js +19 -0
- package/dist/transfer/capsule-export.js.map +1 -0
- package/dist/transfer/capsule-import.d.ts +124 -0
- package/dist/transfer/capsule-import.js +16 -0
- package/dist/transfer/capsule-import.js.map +1 -0
- package/dist/transfer/constants.d.ts +13 -0
- package/dist/transfer/constants.js +12 -0
- package/dist/transfer/constants.js.map +1 -0
- package/dist/transfer/export-json.d.ts +11 -0
- package/dist/transfer/export-json.js +11 -0
- package/dist/transfer/export-json.js.map +1 -0
- package/dist/transfer/export-md.d.ts +10 -0
- package/dist/transfer/export-md.js +13 -0
- package/dist/transfer/export-md.js.map +1 -0
- package/dist/transfer/export-sqlite.d.ts +9 -0
- package/dist/transfer/export-sqlite.js +12 -0
- package/dist/transfer/export-sqlite.js.map +1 -0
- package/dist/transfer/fs-utils.d.ts +61 -0
- package/dist/transfer/fs-utils.js +40 -0
- package/dist/transfer/fs-utils.js.map +1 -0
- package/dist/transfer/import-json.d.ts +16 -0
- package/dist/transfer/import-json.js +13 -0
- package/dist/transfer/import-json.js.map +1 -0
- package/dist/transfer/import-md.d.ts +14 -0
- package/dist/transfer/import-md.js +11 -0
- package/dist/transfer/import-md.js.map +1 -0
- package/dist/transfer/import-sqlite.d.ts +14 -0
- package/dist/transfer/import-sqlite.js +12 -0
- package/dist/transfer/import-sqlite.js.map +1 -0
- package/dist/transfer/sqlite-schema.d.ts +4 -0
- package/dist/transfer/sqlite-schema.js +10 -0
- package/dist/transfer/sqlite-schema.js.map +1 -0
- package/dist/transfer/types.d.ts +916 -0
- package/dist/transfer/types.js +30 -0
- package/dist/transfer/types.js.map +1 -0
- package/dist/types.d.ts +28 -1
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +9 -6
- package/dist/work/board.d.ts +43 -0
- package/dist/work/board.js +14 -0
- package/dist/work/board.js.map +1 -0
- package/dist/work/boundary.d.ts +8 -0
- package/dist/work/boundary.js +14 -0
- package/dist/work/boundary.js.map +1 -0
- package/dist/work/storage.d.ts +39 -0
- package/dist/work/storage.js +11 -0
- package/dist/work/storage.js.map +1 -0
- package/dist/work/types.d.ts +75 -0
- package/dist/work/types.js +1 -0
- package/dist/work/types.js.map +1 -0
- package/package.json +2767 -6
- package/scripts/faiss_index.py +816 -0
- package/scripts/faiss_requirements.txt +3 -0
- package/skills/remnic-entities/SKILL.md +51 -0
- package/skills/remnic-memory-workflow/SKILL.md +61 -0
- package/skills/remnic-recall/SKILL.md +51 -0
- package/skills/remnic-remember/SKILL.md +56 -0
- package/skills/remnic-search/SKILL.md +51 -0
- package/skills/remnic-status/SKILL.md +51 -0
- package/src/abort-error.test.ts +49 -0
- package/src/abort-error.ts +46 -0
- package/src/abstraction-nodes.ts +162 -0
- package/src/access-audit.test.ts +178 -0
- package/src/access-audit.ts +125 -0
- package/src/access-cli.test.ts +439 -0
- package/src/access-cli.ts +438 -0
- package/src/access-http.test.ts +225 -0
- package/src/access-http.ts +1899 -0
- package/src/access-idempotency.ts +232 -0
- package/src/access-mcp.test.ts +568 -0
- package/src/access-mcp.ts +3056 -0
- package/src/access-schema-pi.test.ts +60 -0
- package/src/access-schema.ts +522 -0
- package/src/access-service-namespace.test.ts +123 -0
- package/src/access-service.ts +5629 -0
- package/src/action-confidence.test.ts +206 -0
- package/src/action-confidence.ts +466 -0
- package/src/active-memory-bridge.test.ts +285 -0
- package/src/active-memory-bridge.ts +217 -0
- package/src/active-recall.test.ts +484 -0
- package/src/active-recall.ts +459 -0
- package/src/adapters/claude-code.ts +56 -0
- package/src/adapters/codex.ts +57 -0
- package/src/adapters/hermes.ts +64 -0
- package/src/adapters/index.ts +6 -0
- package/src/adapters/registry.ts +41 -0
- package/src/adapters/replit.ts +55 -0
- package/src/adapters/types.ts +51 -0
- package/src/behavior-learner.ts +144 -0
- package/src/behavior-signals.ts +73 -0
- package/src/binary-lifecycle/backend.ts +117 -0
- package/src/binary-lifecycle/index.ts +35 -0
- package/src/binary-lifecycle/manifest.ts +79 -0
- package/src/binary-lifecycle/pipeline.ts +352 -0
- package/src/binary-lifecycle/scanner.ts +89 -0
- package/src/binary-lifecycle/types.ts +89 -0
- package/src/bootstrap.ts +178 -0
- package/src/boxes.ts +521 -0
- package/src/briefing.test.ts +1535 -0
- package/src/briefing.ts +1382 -0
- package/src/buffer-session.test.ts +443 -0
- package/src/buffer-surprise-report.ts +176 -0
- package/src/buffer-surprise-telemetry.test.ts +606 -0
- package/src/buffer-surprise-trigger.test.ts +766 -0
- package/src/buffer-surprise.test.ts +339 -0
- package/src/buffer-surprise.ts +203 -0
- package/src/buffer.ts +900 -0
- package/src/bulk-import/cli-command.test.ts +204 -0
- package/src/bulk-import/index.ts +34 -0
- package/src/bulk-import/pipeline.test.ts +445 -0
- package/src/bulk-import/pipeline.ts +178 -0
- package/src/bulk-import/registry.test.ts +151 -0
- package/src/bulk-import/registry.ts +72 -0
- package/src/bulk-import/types.test.ts +272 -0
- package/src/bulk-import/types.ts +145 -0
- package/src/calibration.ts +394 -0
- package/src/capsule-cli.test.ts +398 -0
- package/src/capsule-cli.ts +565 -0
- package/src/causal-behavior.ts +308 -0
- package/src/causal-chain.ts +419 -0
- package/src/causal-consolidation.ts +370 -0
- package/src/causal-retrieval.ts +286 -0
- package/src/causal-trajectory-graph.ts +60 -0
- package/src/causal-trajectory.ts +303 -0
- package/src/chunking.ts +220 -0
- package/src/citations.ts +232 -0
- package/src/cli.ts +9403 -0
- package/src/codex-cli-fallback.ts +162 -0
- package/src/codex-thread-key.ts +1 -0
- package/src/coding/access-coding-context.test.ts +197 -0
- package/src/coding/coding-branch-scope.test.ts +281 -0
- package/src/coding/coding-namespace.test.ts +360 -0
- package/src/coding/coding-namespace.ts +412 -0
- package/src/coding/coding-orchestrator.test.ts +249 -0
- package/src/coding/git-context.test.ts +507 -0
- package/src/coding/git-context.ts +336 -0
- package/src/coding/mcp-set-coding-context.test.ts +174 -0
- package/src/coding/review-context.test.ts +316 -0
- package/src/coding/review-context.ts +349 -0
- package/src/coding/wire-coding-context.test.ts +468 -0
- package/src/commitment-ledger.test.ts +78 -0
- package/src/commitment-ledger.ts +337 -0
- package/src/compat/checks.test.ts +206 -0
- package/src/compat/checks.ts +716 -0
- package/src/compat/types.ts +33 -0
- package/src/compounding/engine.ts +1686 -0
- package/src/compounding/preference-consolidator.ts +778 -0
- package/src/compression-optimizer.ts +312 -0
- package/src/config.test.ts +930 -0
- package/src/config.ts +3807 -0
- package/src/connectors/codex/instructions.md +160 -0
- package/src/connectors/codex/resources/namespace-cheatsheet.md +48 -0
- package/src/connectors/codex-marketplace.ts +500 -0
- package/src/connectors/codex-materialize-runner.ts +212 -0
- package/src/connectors/codex-materialize.ts +983 -0
- package/src/connectors/coerce.ts +62 -0
- package/src/connectors/index.test.ts +1570 -0
- package/src/connectors/index.ts +3222 -0
- package/src/connectors/live/framework.ts +164 -0
- package/src/connectors/live/github.test.ts +1218 -0
- package/src/connectors/live/github.ts +1068 -0
- package/src/connectors/live/gmail.test.ts +1706 -0
- package/src/connectors/live/gmail.ts +1293 -0
- package/src/connectors/live/google-drive.test.ts +696 -0
- package/src/connectors/live/google-drive.ts +724 -0
- package/src/connectors/live/index.ts +101 -0
- package/src/connectors/live/live-connectors.test.ts +689 -0
- package/src/connectors/live/notion.test.ts +1109 -0
- package/src/connectors/live/notion.ts +978 -0
- package/src/connectors/live/registry.ts +103 -0
- package/src/connectors/live/state-store.ts +399 -0
- package/src/connectors/live/transient-errors.ts +150 -0
- package/src/connectors/weclone-installer.test.ts +850 -0
- package/src/connectors-cli.ts +513 -0
- package/src/console/state.test.ts +224 -0
- package/src/console/state.ts +514 -0
- package/src/console/trace.test.ts +813 -0
- package/src/console/trace.ts +603 -0
- package/src/console/tui.test.ts +582 -0
- package/src/console/tui.ts +508 -0
- package/src/consolidation-operator.ts +182 -0
- package/src/consolidation-provenance-check.ts +551 -0
- package/src/consolidation-undo.ts +718 -0
- package/src/contradiction/contradiction-judge.test.ts +189 -0
- package/src/contradiction/contradiction-judge.ts +333 -0
- package/src/contradiction/contradiction-review.ts +574 -0
- package/src/contradiction/contradiction-scan.ts +504 -0
- package/src/contradiction/contradiction.test.ts +2230 -0
- package/src/contradiction/index.ts +37 -0
- package/src/contradiction/resolution.ts +383 -0
- package/src/conversation-index/backend.ts +323 -0
- package/src/conversation-index/chunker.ts +47 -0
- package/src/conversation-index/cleanup.ts +53 -0
- package/src/conversation-index/faiss-adapter.ts +384 -0
- package/src/conversation-index/indexer.test.ts +164 -0
- package/src/conversation-index/indexer.ts +192 -0
- package/src/conversation-index/search.ts +37 -0
- package/src/cross-namespace-budget.test.ts +275 -0
- package/src/cross-namespace-budget.ts +365 -0
- package/src/cue-anchors.ts +163 -0
- package/src/curation/index.ts +544 -0
- package/src/dashboard-runtime.ts +337 -0
- package/src/day-summary.ts +122 -0
- package/src/dedup/index.ts +330 -0
- package/src/dedup/semantic.test.ts +1577 -0
- package/src/dedup/semantic.ts +148 -0
- package/src/delinearize.ts +193 -0
- package/src/direct-answer-wiring.test.ts +473 -0
- package/src/direct-answer-wiring.ts +180 -0
- package/src/direct-answer.test.ts +484 -0
- package/src/direct-answer.ts +273 -0
- package/src/embedding-fallback.ts +565 -0
- package/src/enrichment/audit.ts +89 -0
- package/src/enrichment/index.ts +27 -0
- package/src/enrichment/pipeline.ts +197 -0
- package/src/enrichment/provider-registry.ts +85 -0
- package/src/enrichment/types.ts +100 -0
- package/src/enrichment/web-search-provider.ts +63 -0
- package/src/entity-retrieval.ts +774 -0
- package/src/entity-schema.ts +239 -0
- package/src/evals.ts +1312 -0
- package/src/event-order-recall.test.ts +4164 -0
- package/src/event-order-recall.ts +2802 -0
- package/src/evidence-pack.test.ts +89 -0
- package/src/evidence-pack.ts +388 -0
- package/src/explicit-capture.ts +530 -0
- package/src/explicit-cue-recall.test.ts +3019 -0
- package/src/explicit-cue-recall.ts +5545 -0
- package/src/extraction-judge-telemetry.ts +234 -0
- package/src/extraction-judge-training.ts +221 -0
- package/src/extraction-judge.ts +846 -0
- package/src/extraction-timeout.test.ts +265 -0
- package/src/extraction.ts +2719 -0
- package/src/fallback-llm.test.ts +1060 -0
- package/src/fallback-llm.ts +918 -0
- package/src/focused-list-recall.test.ts +734 -0
- package/src/focused-list-recall.ts +1160 -0
- package/src/graph-dashboard-diff.ts +35 -0
- package/src/graph-dashboard-key.ts +5 -0
- package/src/graph-dashboard-parser.ts +104 -0
- package/src/graph-edge-reinforcement.ts +192 -0
- package/src/graph-events.ts +151 -0
- package/src/graph-recall.test.ts +164 -0
- package/src/graph-recall.ts +189 -0
- package/src/graph-retrieval.test.ts +809 -0
- package/src/graph-retrieval.ts +823 -0
- package/src/graph-snapshot.ts +329 -0
- package/src/graph.ts +813 -0
- package/src/harmonic-retrieval.ts +223 -0
- package/src/himem.ts +154 -0
- package/src/hygiene.ts +87 -0
- package/src/identity-continuity.ts +333 -0
- package/src/importance.ts +328 -0
- package/src/importers/base.test.ts +294 -0
- package/src/importers/base.ts +436 -0
- package/src/importers/index.ts +21 -0
- package/src/index.ts +1204 -0
- package/src/intent.ts +154 -0
- package/src/json-extract.ts +85 -0
- package/src/json-store.ts +42 -0
- package/src/lcm/archive.ts +617 -0
- package/src/lcm/dag.ts +199 -0
- package/src/lcm/engine.ts +645 -0
- package/src/lcm/index.ts +7 -0
- package/src/lcm/queue.test.ts +178 -0
- package/src/lcm/queue.ts +200 -0
- package/src/lcm/recall.ts +117 -0
- package/src/lcm/schema.ts +154 -0
- package/src/lcm/summarizer.ts +235 -0
- package/src/lcm/tools.ts +191 -0
- package/src/lcm-engine.test.ts +660 -0
- package/src/legacy-hook-compat.test.ts +20 -0
- package/src/legacy-hook-compat.ts +45 -0
- package/src/lifecycle.ts +289 -0
- package/src/live-connectors-runner.ts +385 -0
- package/src/local-llm-qos.test.ts +303 -0
- package/src/local-llm-thinking.test.ts +292 -0
- package/src/local-llm.ts +1464 -0
- package/src/logger.ts +49 -0
- package/src/maintenance/archive-observations.ts +147 -0
- package/src/maintenance/backup-stamp.ts +3 -0
- package/src/maintenance/dreams-ledger.ts +516 -0
- package/src/maintenance/first-start-migration.ts +362 -0
- package/src/maintenance/forget.test.ts +206 -0
- package/src/maintenance/forget.ts +126 -0
- package/src/maintenance/graph-edge-decay.test.ts +409 -0
- package/src/maintenance/graph-edge-decay.ts +394 -0
- package/src/maintenance/memory-governance-cron.ts +447 -0
- package/src/maintenance/memory-governance.ts +1039 -0
- package/src/maintenance/migrate-observations.ts +216 -0
- package/src/maintenance/observation-ledger-utils.ts +54 -0
- package/src/maintenance/pattern-reinforcement.test.ts +875 -0
- package/src/maintenance/pattern-reinforcement.ts +369 -0
- package/src/maintenance/purge.ts +334 -0
- package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +78 -0
- package/src/maintenance/rebuild-memory-projection.ts +1234 -0
- package/src/maintenance/rebuild-observations.ts +178 -0
- package/src/maintenance/tier-stats.test.ts +378 -0
- package/src/maintenance/tier-stats.ts +222 -0
- package/src/mcp-memory-inspector-app.ts +421 -0
- package/src/memory-action-policy.ts +80 -0
- package/src/memory-cache.ts +208 -0
- package/src/memory-extension/claude-code-publisher.ts +51 -0
- package/src/memory-extension/codex-publisher.ts +149 -0
- package/src/memory-extension/hermes-publisher.ts +51 -0
- package/src/memory-extension/index.ts +100 -0
- package/src/memory-extension/shared-instructions.ts +133 -0
- package/src/memory-extension/types.ts +86 -0
- package/src/memory-extension-host/host-discovery.ts +276 -0
- package/src/memory-extension-host/index.ts +14 -0
- package/src/memory-extension-host/render-extensions-block.ts +73 -0
- package/src/memory-extension-host/types.ts +21 -0
- package/src/memory-lifecycle-ledger-utils.ts +116 -0
- package/src/memory-projection-format.ts +11 -0
- package/src/memory-projection-store.ts +951 -0
- package/src/memory-provenance.test.ts +196 -0
- package/src/memory-provenance.ts +484 -0
- package/src/memory-worth-bench.test.ts +71 -0
- package/src/memory-worth-bench.ts +265 -0
- package/src/memory-worth-filter.test.ts +209 -0
- package/src/memory-worth-filter.ts +204 -0
- package/src/memory-worth-frontmatter.test.ts +311 -0
- package/src/memory-worth-outcomes.test.ts +316 -0
- package/src/memory-worth-outcomes.ts +286 -0
- package/src/memory-worth.test.ts +317 -0
- package/src/memory-worth.ts +215 -0
- package/src/message-parts/index.ts +806 -0
- package/src/message-parts/message-parts.test.ts +421 -0
- package/src/migrate/from-engram.ts +789 -0
- package/src/model-registry.ts +313 -0
- package/src/models-json.ts +76 -0
- package/src/namespaces/migrate.ts +187 -0
- package/src/namespaces/path.ts +25 -0
- package/src/namespaces/principal.test.ts +195 -0
- package/src/namespaces/principal.ts +86 -0
- package/src/namespaces/search.test.ts +105 -0
- package/src/namespaces/search.ts +233 -0
- package/src/namespaces/storage.ts +74 -0
- package/src/native-knowledge.ts +1823 -0
- package/src/negative.ts +72 -0
- package/src/network/tailscale.ts +179 -0
- package/src/network/webdav.ts +385 -0
- package/src/objective-state-writers.ts +951 -0
- package/src/objective-state.ts +320 -0
- package/src/onboarding/index.ts +529 -0
- package/src/openai-chat-compat.ts +56 -0
- package/src/operator-toolkit.ts +2132 -0
- package/src/opik-exporter.test.ts +72 -0
- package/src/opik-exporter.ts +587 -0
- package/src/orchestrator-extraction-queue.test.ts +197 -0
- package/src/orchestrator-flush.test.ts +1171 -0
- package/src/orchestrator-pattern-reinforcement.test.ts +128 -0
- package/src/orchestrator-source-attribution.test.ts +701 -0
- package/src/orchestrator.ts +16368 -0
- package/src/page-versioning.ts +450 -0
- package/src/patterns-cli.ts +574 -0
- package/src/peers/index.ts +54 -0
- package/src/peers/migrate-from-identity-anchor.test.ts +291 -0
- package/src/peers/migrate-from-identity-anchor.ts +350 -0
- package/src/peers/peers.test.ts +419 -0
- package/src/peers/profile-reasoner.ts +694 -0
- package/src/peers/storage.ts +1350 -0
- package/src/peers/types.ts +138 -0
- package/src/plugin-id.ts +84 -0
- package/src/policy-runtime.ts +209 -0
- package/src/procedural/procedure-miner.ts +150 -0
- package/src/procedural/procedure-recall.ts +93 -0
- package/src/procedural/procedure-stats.ts +213 -0
- package/src/procedural/procedure-types.ts +132 -0
- package/src/procedural/reinforcement-core.test.ts +132 -0
- package/src/procedural/reinforcement-core.ts +73 -0
- package/src/profiling.test.ts +263 -0
- package/src/profiling.ts +435 -0
- package/src/projection/index.ts +398 -0
- package/src/qmd-recall-cache.test.ts +138 -0
- package/src/qmd-recall-cache.ts +111 -0
- package/src/qmd.test.ts +257 -0
- package/src/qmd.ts +2614 -0
- package/src/reasoning-trace-recall.ts +201 -0
- package/src/reasoning-trace-types.ts +235 -0
- package/src/recall-audit-anomaly.test.ts +246 -0
- package/src/recall-audit-anomaly.ts +297 -0
- package/src/recall-audit.test.ts +51 -0
- package/src/recall-audit.ts +72 -0
- package/src/recall-budget-config.test.ts +87 -0
- package/src/recall-disclosure-escalation.test.ts +196 -0
- package/src/recall-disclosure-escalation.ts +158 -0
- package/src/recall-disclosure-shaping.test.ts +146 -0
- package/src/recall-disclosure.test.ts +214 -0
- package/src/recall-explain-renderer.test.ts +140 -0
- package/src/recall-explain-renderer.ts +356 -0
- package/src/recall-mmr.test.ts +808 -0
- package/src/recall-mmr.ts +607 -0
- package/src/recall-qos.test.ts +85 -0
- package/src/recall-qos.ts +82 -0
- package/src/recall-query-policy.ts +221 -0
- package/src/recall-state.test.ts +233 -0
- package/src/recall-state.ts +456 -0
- package/src/recall-tag-filter.ts +143 -0
- package/src/recall-tokenization.ts +35 -0
- package/src/recall-xray-cli.test.ts +118 -0
- package/src/recall-xray-cli.ts +100 -0
- package/src/recall-xray-disclosure-telemetry.test.ts +183 -0
- package/src/recall-xray-renderer.test.ts +539 -0
- package/src/recall-xray-renderer.ts +487 -0
- package/src/recall-xray.test.ts +503 -0
- package/src/recall-xray.ts +621 -0
- package/src/reconstruct.ts +41 -0
- package/src/release-changelog.ts +35 -0
- package/src/relevance.ts +67 -0
- package/src/replay/normalizers/chatgpt.ts +133 -0
- package/src/replay/normalizers/claude.ts +102 -0
- package/src/replay/normalizers/openclaw.ts +119 -0
- package/src/replay/normalizers/shared.ts +69 -0
- package/src/replay/runner.ts +197 -0
- package/src/replay/types.ts +143 -0
- package/src/rerank.test.ts +48 -0
- package/src/rerank.ts +176 -0
- package/src/resolve-auth-token.test.ts +226 -0
- package/src/resolve-auth-token.ts +151 -0
- package/src/resolve-provider-secret.test.ts +187 -0
- package/src/resolve-provider-secret.ts +410 -0
- package/src/response-guidance-recall.test.ts +3952 -0
- package/src/response-guidance-recall.ts +4431 -0
- package/src/resume-bundles.ts +415 -0
- package/src/retrieval-agents.ts +623 -0
- package/src/retrieval-tiers.ts +25 -0
- package/src/retrieval.ts +104 -0
- package/src/review/index.test.ts +201 -0
- package/src/review/index.ts +536 -0
- package/src/routing/engine.ts +162 -0
- package/src/routing/store.ts +321 -0
- package/src/runtime/better-sqlite.test.ts +32 -0
- package/src/runtime/better-sqlite.ts +76 -0
- package/src/runtime/child-process.ts +67 -0
- package/src/runtime/env.ts +48 -0
- package/src/sanitize.ts +58 -0
- package/src/schemas.ts +449 -0
- package/src/sdk-compat.ts +87 -0
- package/src/search/document-scanner.ts +96 -0
- package/src/search/embed-helper.ts +142 -0
- package/src/search/factory.ts +189 -0
- package/src/search/index.ts +10 -0
- package/src/search/lancedb-backend.ts +342 -0
- package/src/search/meilisearch-backend.ts +232 -0
- package/src/search/noop-backend.ts +57 -0
- package/src/search/orama-backend.ts +358 -0
- package/src/search/port.ts +86 -0
- package/src/search/remote-backend.ts +124 -0
- package/src/secure-store/cipher.ts +271 -0
- package/src/secure-store/cli-handlers.ts +355 -0
- package/src/secure-store/cli-renderer.ts +131 -0
- package/src/secure-store/header.ts +373 -0
- package/src/secure-store/index.ts +137 -0
- package/src/secure-store/kdf.ts +263 -0
- package/src/secure-store/keyring.ts +106 -0
- package/src/secure-store/metadata.ts +394 -0
- package/src/secure-store/passphrase-reader.ts +252 -0
- package/src/secure-store/secure-fs.ts +571 -0
- package/src/secure-store/secure-store.test.ts +755 -0
- package/src/semantic-chunking.ts +545 -0
- package/src/semantic-consolidation.test.ts +182 -0
- package/src/semantic-consolidation.ts +432 -0
- package/src/semantic-rule-promotion.ts +183 -0
- package/src/semantic-rule-verifier.ts +160 -0
- package/src/session-integrity.ts +569 -0
- package/src/session-observer-bands.ts +11 -0
- package/src/session-observer-state.ts +346 -0
- package/src/session-toggles.test.ts +96 -0
- package/src/session-toggles.ts +159 -0
- package/src/shared-context/manager.ts +810 -0
- package/src/signal.ts +84 -0
- package/src/skills-registry.test.ts +277 -0
- package/src/skills-registry.ts +120 -0
- package/src/source-attribution-roundtrip.test.ts +215 -0
- package/src/source-attribution.test.ts +1425 -0
- package/src/source-attribution.ts +639 -0
- package/src/spaces/index.ts +627 -0
- package/src/storage-paths.ts +117 -0
- package/src/storage.ts +6657 -0
- package/src/store-contract.ts +55 -0
- package/src/summarizer.ts +844 -0
- package/src/summary-snapshot.test.ts +681 -0
- package/src/summary-snapshot.ts +238 -0
- package/src/surfaces/dreams.test.ts +394 -0
- package/src/surfaces/dreams.ts +346 -0
- package/src/surfaces/heartbeat.test.ts +415 -0
- package/src/surfaces/heartbeat.ts +325 -0
- package/src/sync/index.ts +308 -0
- package/src/targeted-fact-recall.test.ts +1694 -0
- package/src/targeted-fact-recall.ts +2905 -0
- package/src/taxonomy/default-taxonomy.ts +87 -0
- package/src/taxonomy/index.ts +26 -0
- package/src/taxonomy/resolver-doc-generator.ts +57 -0
- package/src/taxonomy/resolver.ts +184 -0
- package/src/taxonomy/taxonomy-loader.ts +186 -0
- package/src/taxonomy/types.ts +48 -0
- package/src/telemetry-transcript.ts +70 -0
- package/src/temporal-index.ts +890 -0
- package/src/temporal-supersession.test.ts +2703 -0
- package/src/temporal-supersession.ts +493 -0
- package/src/temporal-validity.test.ts +448 -0
- package/src/temporal-validity.ts +123 -0
- package/src/threading.ts +395 -0
- package/src/tier-migration.ts +124 -0
- package/src/tier-routing.ts +102 -0
- package/src/tmt.ts +462 -0
- package/src/tokens.test.ts +178 -0
- package/src/tokens.ts +279 -0
- package/src/topics.ts +147 -0
- package/src/training-export/cli-date-validation.test.ts +258 -0
- package/src/training-export/converter.test.ts +452 -0
- package/src/training-export/converter.ts +319 -0
- package/src/training-export/date-parse.ts +117 -0
- package/src/training-export/index.ts +26 -0
- package/src/training-export/registry.test.ts +85 -0
- package/src/training-export/registry.ts +57 -0
- package/src/training-export/types.ts +31 -0
- package/src/transcript.ts +1179 -0
- package/src/transfer/autodetect.ts +30 -0
- package/src/transfer/backup.ts +138 -0
- package/src/transfer/capsule-crypto.ts +485 -0
- package/src/transfer/capsule-encrypt.test.ts +690 -0
- package/src/transfer/capsule-export.ts +543 -0
- package/src/transfer/capsule-fork.ts +375 -0
- package/src/transfer/capsule-import.ts +564 -0
- package/src/transfer/capsule-merge.ts +433 -0
- package/src/transfer/conflict-policy.ts +16 -0
- package/src/transfer/constants.ts +13 -0
- package/src/transfer/exclusions.ts +37 -0
- package/src/transfer/export-json.ts +65 -0
- package/src/transfer/export-md.ts +59 -0
- package/src/transfer/export-sqlite.ts +52 -0
- package/src/transfer/fs-utils.ts +269 -0
- package/src/transfer/import-json.ts +108 -0
- package/src/transfer/import-md.ts +84 -0
- package/src/transfer/import-sqlite.ts +100 -0
- package/src/transfer/integrity.ts +71 -0
- package/src/transfer/sqlite-schema.ts +16 -0
- package/src/transfer/types.ts +297 -0
- package/src/trust-zones.ts +1186 -0
- package/src/types.ts +3074 -0
- package/src/user-model.test.ts +124 -0
- package/src/user-model.ts +162 -0
- package/src/utility-learner.ts +353 -0
- package/src/utility-runtime.ts +88 -0
- package/src/utility-telemetry.ts +215 -0
- package/src/utils/category-dir.ts +44 -0
- package/src/utils/errno.ts +6 -0
- package/src/utils/iso-timestamp.test.ts +37 -0
- package/src/utils/iso-timestamp.ts +164 -0
- package/src/utils/path.ts +26 -0
- package/src/verified-recall.ts +138 -0
- package/src/version-utils.test.ts +10 -0
- package/src/version-utils.ts +9 -0
- package/src/whitespace.ts +10 -0
- package/src/work/board.ts +359 -0
- package/src/work/boundary.ts +107 -0
- package/src/work/storage.ts +436 -0
- package/src/work/types.ts +82 -0
- package/src/work-product-ledger.ts +265 -0
- package/dist/access-service-DDjzFALq.d.ts +0 -2088
- package/dist/capsule-crypto-SJS5VVAP.js +0 -18
- package/dist/capsule-export-7QNCBZOQ.js +0 -17
- package/dist/capsule-import-EPBHD2EN.js +0 -16
- package/dist/capsule-merge-DI7PNQ2H.js +0 -189
- package/dist/chunk-23ZZK64Y.js +0 -26
- package/dist/chunk-23ZZK64Y.js.map +0 -1
- package/dist/chunk-242S3I2A.js +0 -647
- package/dist/chunk-2LGMW3DJ.js +0 -111
- package/dist/chunk-3B6KIRBH.js +0 -5213
- package/dist/chunk-3B6KIRBH.js.map +0 -1
- package/dist/chunk-457A4P3L.js +0 -119
- package/dist/chunk-457A4P3L.js.map +0 -1
- package/dist/chunk-4IS4SXIQ.js +0 -2040
- package/dist/chunk-4YM32CRU.js +0 -721
- package/dist/chunk-6TBWYBJ3.js +0 -236
- package/dist/chunk-74EMIVE4.js +0 -329
- package/dist/chunk-74EMIVE4.js.map +0 -1
- package/dist/chunk-767ODGE6.js +0 -183
- package/dist/chunk-7V22HTMD.js +0 -623
- package/dist/chunk-7V22HTMD.js.map +0 -1
- package/dist/chunk-7ZM3BFKK.js +0 -9705
- package/dist/chunk-7ZM3BFKK.js.map +0 -1
- package/dist/chunk-AQJNPMOA.js +0 -643
- package/dist/chunk-AQJNPMOA.js.map +0 -1
- package/dist/chunk-ASAITVLA.js +0 -64
- package/dist/chunk-ASAITVLA.js.map +0 -1
- package/dist/chunk-BBE34QBJ.js +0 -275
- package/dist/chunk-BBE34QBJ.js.map +0 -1
- package/dist/chunk-BZSQEPRW.js +0 -14710
- package/dist/chunk-BZSQEPRW.js.map +0 -1
- package/dist/chunk-CPKTBRS2.js +0 -891
- package/dist/chunk-CPKTBRS2.js.map +0 -1
- package/dist/chunk-D4GAOFF6.js +0 -562
- package/dist/chunk-D4GAOFF6.js.map +0 -1
- package/dist/chunk-D54LZC5L.js +0 -147
- package/dist/chunk-DF3RVK3X.js +0 -119
- package/dist/chunk-DF3RVK3X.js.map +0 -1
- package/dist/chunk-DZZPC36E.js +0 -1451
- package/dist/chunk-DZZPC36E.js.map +0 -1
- package/dist/chunk-E2UCDP5S.js +0 -570
- package/dist/chunk-E6K4NIEU.js +0 -747
- package/dist/chunk-E6K4NIEU.js.map +0 -1
- package/dist/chunk-EEQLFRUM.js +0 -89
- package/dist/chunk-ETOW6ACV.js +0 -158
- package/dist/chunk-ETOW6ACV.js.map +0 -1
- package/dist/chunk-FMEBPEAO.js +0 -347
- package/dist/chunk-FMEBPEAO.js.map +0 -1
- package/dist/chunk-FQDPCE3I.js +0 -1837
- package/dist/chunk-FQDPCE3I.js.map +0 -1
- package/dist/chunk-FYIYMQ5N.js +0 -221
- package/dist/chunk-FYIYMQ5N.js.map +0 -1
- package/dist/chunk-G2WADRQ3.js +0 -219
- package/dist/chunk-G4SK7DSQ.js +0 -121
- package/dist/chunk-GVPWB7EY.js +0 -390
- package/dist/chunk-GVPWB7EY.js.map +0 -1
- package/dist/chunk-HELQZFZO.js +0 -1075
- package/dist/chunk-HL5LRPNA.js +0 -1914
- package/dist/chunk-HL5LRPNA.js.map +0 -1
- package/dist/chunk-HQZVVSVB.js +0 -147
- package/dist/chunk-HQZVVSVB.js.map +0 -1
- package/dist/chunk-HY3L4WKC.js +0 -2195
- package/dist/chunk-HY3L4WKC.js.map +0 -1
- package/dist/chunk-IB3BFHGN.js +0 -228
- package/dist/chunk-IXEJRKCZ.js +0 -18
- package/dist/chunk-JBMSGZEQ.js +0 -441
- package/dist/chunk-JBMSGZEQ.js.map +0 -1
- package/dist/chunk-JESOB2HO.js +0 -108
- package/dist/chunk-JKDVIE52.js +0 -272
- package/dist/chunk-JRNQ3RNA.js +0 -284
- package/dist/chunk-JRNQ3RNA.js.map +0 -1
- package/dist/chunk-K6WK37A6.js +0 -865
- package/dist/chunk-K6WK37A6.js.map +0 -1
- package/dist/chunk-MARWOCVP.js +0 -48
- package/dist/chunk-MNU6ZBWT.js +0 -4454
- package/dist/chunk-MNU6ZBWT.js.map +0 -1
- package/dist/chunk-N5AKDXAI.js +0 -74
- package/dist/chunk-OA3L7BFR.js +0 -183
- package/dist/chunk-OA3L7BFR.js.map +0 -1
- package/dist/chunk-OR64ZGRZ.js +0 -23
- package/dist/chunk-P77UEOU2.js +0 -1521
- package/dist/chunk-P77UEOU2.js.map +0 -1
- package/dist/chunk-PH4C2U43.js +0 -239
- package/dist/chunk-PH4C2U43.js.map +0 -1
- package/dist/chunk-RVPLBATS.js +0 -1586
- package/dist/chunk-RVPLBATS.js.map +0 -1
- package/dist/chunk-U5JMRGKX.js +0 -340
- package/dist/chunk-U5JMRGKX.js.map +0 -1
- package/dist/chunk-URB2WSKZ.js +0 -350
- package/dist/chunk-URB2WSKZ.js.map +0 -1
- package/dist/chunk-UVMUAWVT.js +0 -596
- package/dist/chunk-WEJG4TB5.js +0 -118
- package/dist/chunk-X7HPGUVG.js +0 -271
- package/dist/chunk-XAMBKFQS.js +0 -2777
- package/dist/chunk-XAMBKFQS.js.map +0 -1
- package/dist/chunk-XJKFSSDW.js +0 -726
- package/dist/chunk-XJKFSSDW.js.map +0 -1
- package/dist/chunk-XMHBH5H6.js +0 -283
- package/dist/chunk-XMHBH5H6.js.map +0 -1
- package/dist/chunk-XMVFHBHT.js +0 -277
- package/dist/chunk-Y3VMVTYX.js +0 -53
- package/dist/chunk-YNB73F22.js +0 -137
- package/dist/chunk-YNB73F22.js.map +0 -1
- package/dist/chunk-Z2E7VW55.js +0 -335
- package/dist/chunk-Z2E7VW55.js.map +0 -1
- package/dist/chunk-ZG7PTKBK.js +0 -2296
- package/dist/chunk-ZNQN6ZTA.js +0 -135
- package/dist/chunk-ZVTKDVVM.js +0 -827
- package/dist/chunk-ZVTKDVVM.js.map +0 -1
- package/dist/cli-BR8KpIU0.d.ts +0 -1259
- package/dist/codex-materialize-CQlLTzke.d.ts +0 -139
- package/dist/connectors-cli-DFGtY2DB.d.ts +0 -257
- package/dist/contradiction-review-5LTTVDQV.js +0 -22
- package/dist/contradiction-scan-QTXAMBUA.js +0 -414
- package/dist/contradiction-scan-QTXAMBUA.js.map +0 -1
- package/dist/engine-35M5BKQ7.js +0 -28
- package/dist/fs-utils-IRVUFB6G.js +0 -30
- package/dist/graph-edge-decay-PWB63GRE.js +0 -207
- package/dist/memory-governance-IMPQZXFC.js +0 -37
- package/dist/memory-projection-store-CY8TU40w.d.ts +0 -222
- package/dist/orchestrator-DDMPqU6R.d.ts +0 -1792
- package/dist/path-RMTY5Y5A.js +0 -9
- package/dist/port-B6VEDIkC.d.ts +0 -53
- package/dist/resolution-YGIBORXI.js +0 -101
- package/dist/resolution-YGIBORXI.js.map +0 -1
- package/dist/secure-store-4R2GSO7S.js +0 -156
- package/dist/semantic-consolidation-ByBXb-sf.d.ts +0 -180
- package/dist/state-store-3EH7HYIN.js +0 -16
- package/dist/types-V3FJ26TF.js +0 -30
- /package/dist/{capsule-crypto-SJS5VVAP.js.map → adapters/claude-code.js.map} +0 -0
- /package/dist/{capsule-export-7QNCBZOQ.js.map → adapters/codex.js.map} +0 -0
- /package/dist/{capsule-import-EPBHD2EN.js.map → adapters/hermes.js.map} +0 -0
- /package/dist/{contradiction-review-5LTTVDQV.js.map → adapters/index.js.map} +0 -0
- /package/dist/{engine-35M5BKQ7.js.map → adapters/registry.js.map} +0 -0
- /package/dist/{fs-utils-IRVUFB6G.js.map → adapters/replit.js.map} +0 -0
- /package/dist/{memory-governance-IMPQZXFC.js.map → adapters/types.js.map} +0 -0
- /package/dist/{path-RMTY5Y5A.js.map → capsule-crypto-5CYAGVC5.js.map} +0 -0
- /package/dist/{capsule-merge-DI7PNQ2H.js.map → capsule-merge-4MGKE7C5.js.map} +0 -0
- /package/dist/{chunk-G4SK7DSQ.js.map → chunk-2WWLHTZY.js.map} +0 -0
- /package/dist/{chunk-X7HPGUVG.js.map → chunk-4CRG46BG.js.map} +0 -0
- /package/dist/{chunk-UVMUAWVT.js.map → chunk-7IASACLB.js.map} +0 -0
- /package/dist/{chunk-HELQZFZO.js.map → chunk-EDTHC6UD.js.map} +0 -0
- /package/dist/{chunk-4YM32CRU.js.map → chunk-EFJ3MQ4V.js.map} +0 -0
- /package/dist/{chunk-E2UCDP5S.js.map → chunk-FBYESMQ2.js.map} +0 -0
- /package/dist/{chunk-D54LZC5L.js.map → chunk-FDU6HUUL.js.map} +0 -0
- /package/dist/{chunk-IB3BFHGN.js.map → chunk-GGKRUQOO.js.map} +0 -0
- /package/dist/{chunk-242S3I2A.js.map → chunk-GL6I6MEQ.js.map} +0 -0
- /package/dist/{secure-store-4R2GSO7S.js.map → chunk-HHLLAQGZ.js.map} +0 -0
- /package/dist/{chunk-4IS4SXIQ.js.map → chunk-HXXBL2KD.js.map} +0 -0
- /package/dist/{chunk-767ODGE6.js.map → chunk-KNKUID7G.js.map} +0 -0
- /package/dist/{chunk-6TBWYBJ3.js.map → chunk-LPMVBPA3.js.map} +0 -0
- /package/dist/{chunk-WEJG4TB5.js.map → chunk-MC26UJIM.js.map} +0 -0
- /package/dist/{chunk-JKDVIE52.js.map → chunk-MGKYQQYF.js.map} +0 -0
- /package/dist/{chunk-Y3VMVTYX.js.map → chunk-MT4HVDUZ.js.map} +0 -0
- /package/dist/{chunk-G2WADRQ3.js.map → chunk-MY6TPVXW.js.map} +0 -0
- /package/dist/{chunk-OR64ZGRZ.js.map → chunk-NNVTUXEB.js.map} +0 -0
- /package/dist/{chunk-JESOB2HO.js.map → chunk-P4NEIHUT.js.map} +0 -0
- /package/dist/{chunk-IXEJRKCZ.js.map → chunk-QRNI5JBH.js.map} +0 -0
- /package/dist/{chunk-EEQLFRUM.js.map → chunk-RRF5UOBJ.js.map} +0 -0
- /package/dist/{state-store-3EH7HYIN.js.map → chunk-SEDEKFYQ.js.map} +0 -0
- /package/dist/{chunk-2LGMW3DJ.js.map → chunk-U3PN77QT.js.map} +0 -0
- /package/dist/{chunk-XMVFHBHT.js.map → chunk-U3WSW6PZ.js.map} +0 -0
- /package/dist/{chunk-N5AKDXAI.js.map → chunk-UWVJF25J.js.map} +0 -0
- /package/dist/{types-V3FJ26TF.js.map → chunk-V5OCT34X.js.map} +0 -0
- /package/dist/{chunk-ZG7PTKBK.js.map → chunk-W3LR522O.js.map} +0 -0
- /package/dist/{chunk-MARWOCVP.js.map → chunk-XIG5PDM7.js.map} +0 -0
- /package/dist/{chunk-ZNQN6ZTA.js.map → chunk-XVZ7B3HG.js.map} +0 -0
- /package/dist/{graph-edge-decay-PWB63GRE.js.map → graph-edge-decay-5DI5GUNL.js.map} +0 -0
|
@@ -0,0 +1,2185 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildTokenEntry,
|
|
3
|
+
commitTokenEntry,
|
|
4
|
+
generateToken,
|
|
5
|
+
loadTokenStore,
|
|
6
|
+
revokeToken,
|
|
7
|
+
saveTokenStore
|
|
8
|
+
} from "./chunk-MSWG7JI6.js";
|
|
9
|
+
import {
|
|
10
|
+
coerceInstallExtension
|
|
11
|
+
} from "./chunk-PHK3HARR.js";
|
|
12
|
+
import {
|
|
13
|
+
launchProcessSync
|
|
14
|
+
} from "./chunk-NNVTUXEB.js";
|
|
15
|
+
import {
|
|
16
|
+
expandTildePath
|
|
17
|
+
} from "./chunk-QRNI5JBH.js";
|
|
18
|
+
import {
|
|
19
|
+
mergeEnv,
|
|
20
|
+
readEnvVar,
|
|
21
|
+
resolveHomeDir
|
|
22
|
+
} from "./chunk-XIG5PDM7.js";
|
|
23
|
+
import {
|
|
24
|
+
log
|
|
25
|
+
} from "./chunk-2ODBA7MQ.js";
|
|
26
|
+
|
|
27
|
+
// src/connectors/index.ts
|
|
28
|
+
import fs2 from "fs";
|
|
29
|
+
import path2 from "path";
|
|
30
|
+
import os from "os";
|
|
31
|
+
import { createRequire } from "module";
|
|
32
|
+
import { fileURLToPath } from "url";
|
|
33
|
+
|
|
34
|
+
// src/connectors/codex-marketplace.ts
|
|
35
|
+
import fs from "fs";
|
|
36
|
+
import path from "path";
|
|
37
|
+
var MARKETPLACE_SCHEMA_VERSION = 1;
|
|
38
|
+
var MARKETPLACE_MANIFEST_FILENAME = "marketplace.json";
|
|
39
|
+
var VALID_INSTALL_TYPES = /* @__PURE__ */ new Set(["github", "git", "local", "url"]);
|
|
40
|
+
function generateMarketplaceManifest(options) {
|
|
41
|
+
const version = options?.packageVersion ?? readPackageVersion() ?? "0.0.0";
|
|
42
|
+
return {
|
|
43
|
+
version: MARKETPLACE_SCHEMA_VERSION,
|
|
44
|
+
name: "remnic",
|
|
45
|
+
description: "Remnic: Local-first AI memory with semantic search and consolidation",
|
|
46
|
+
plugins: [
|
|
47
|
+
{
|
|
48
|
+
name: "remnic",
|
|
49
|
+
version,
|
|
50
|
+
description: "Persistent memory plugin for Codex CLI",
|
|
51
|
+
repository: "joshuaswarren/remnic",
|
|
52
|
+
installType: "github",
|
|
53
|
+
entry: "packages/plugin-codex",
|
|
54
|
+
configSchema: "openclaw.plugin.json"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function validateMarketplaceManifest(manifest) {
|
|
60
|
+
const validation = checkMarketplaceManifest(manifest);
|
|
61
|
+
if (!validation.valid) {
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Invalid marketplace manifest: ${validation.errors.join("; ")}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
return manifest;
|
|
67
|
+
}
|
|
68
|
+
function checkMarketplaceManifest(manifest) {
|
|
69
|
+
const errors = [];
|
|
70
|
+
if (typeof manifest !== "object" || manifest === null) {
|
|
71
|
+
return { valid: false, errors: ["manifest must be a non-null object"] };
|
|
72
|
+
}
|
|
73
|
+
const obj = manifest;
|
|
74
|
+
if (obj.version !== MARKETPLACE_SCHEMA_VERSION) {
|
|
75
|
+
errors.push(`version must be ${MARKETPLACE_SCHEMA_VERSION}, got ${JSON.stringify(obj.version)}`);
|
|
76
|
+
}
|
|
77
|
+
if (typeof obj.name !== "string" || obj.name.trim().length === 0) {
|
|
78
|
+
errors.push("name must be a non-empty string");
|
|
79
|
+
}
|
|
80
|
+
if (typeof obj.description !== "string" || obj.description.trim().length === 0) {
|
|
81
|
+
errors.push("description must be a non-empty string");
|
|
82
|
+
}
|
|
83
|
+
if (!Array.isArray(obj.plugins)) {
|
|
84
|
+
errors.push("plugins must be an array");
|
|
85
|
+
} else if (obj.plugins.length === 0) {
|
|
86
|
+
errors.push("plugins must contain at least one entry");
|
|
87
|
+
} else {
|
|
88
|
+
for (let i = 0; i < obj.plugins.length; i++) {
|
|
89
|
+
const plugin = obj.plugins[i];
|
|
90
|
+
const prefix = `plugins[${i}]`;
|
|
91
|
+
if (typeof plugin !== "object" || plugin === null) {
|
|
92
|
+
errors.push(`${prefix} must be a non-null object`);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (typeof plugin.name !== "string" || plugin.name.trim().length === 0) {
|
|
96
|
+
errors.push(`${prefix}.name must be a non-empty string`);
|
|
97
|
+
}
|
|
98
|
+
if (typeof plugin.version !== "string" || plugin.version.trim().length === 0) {
|
|
99
|
+
errors.push(`${prefix}.version must be a non-empty string`);
|
|
100
|
+
}
|
|
101
|
+
if (typeof plugin.description !== "string" || plugin.description.trim().length === 0) {
|
|
102
|
+
errors.push(`${prefix}.description must be a non-empty string`);
|
|
103
|
+
}
|
|
104
|
+
if (typeof plugin.repository !== "string" || plugin.repository.trim().length === 0) {
|
|
105
|
+
errors.push(`${prefix}.repository must be a non-empty string`);
|
|
106
|
+
}
|
|
107
|
+
if (typeof plugin.installType !== "string" || !VALID_INSTALL_TYPES.has(plugin.installType)) {
|
|
108
|
+
errors.push(
|
|
109
|
+
`${prefix}.installType must be one of: ${[...VALID_INSTALL_TYPES].join(", ")}; got ${JSON.stringify(plugin.installType)}`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if ("manifestUrl" in plugin && plugin.manifestUrl !== void 0) {
|
|
113
|
+
if (typeof plugin.manifestUrl !== "string" || plugin.manifestUrl.trim().length === 0) {
|
|
114
|
+
errors.push(`${prefix}.manifestUrl must be a non-empty string when provided`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if ("entry" in plugin && plugin.entry !== void 0) {
|
|
118
|
+
if (typeof plugin.entry !== "string" || plugin.entry.trim().length === 0) {
|
|
119
|
+
errors.push(`${prefix}.entry must be a non-empty string when provided`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if ("configSchema" in plugin && plugin.configSchema !== void 0) {
|
|
123
|
+
if (typeof plugin.configSchema !== "string" || plugin.configSchema.trim().length === 0) {
|
|
124
|
+
errors.push(`${prefix}.configSchema must be a non-empty string when provided`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return { valid: errors.length === 0, errors };
|
|
130
|
+
}
|
|
131
|
+
async function writeMarketplaceManifest(outputDir, manifest) {
|
|
132
|
+
const validation = checkMarketplaceManifest(manifest);
|
|
133
|
+
if (!validation.valid) {
|
|
134
|
+
throw new Error(
|
|
135
|
+
`Refusing to write invalid manifest: ${validation.errors.join("; ")}`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
139
|
+
const destPath = path.join(outputDir, MARKETPLACE_MANIFEST_FILENAME);
|
|
140
|
+
const tmpPath = `${destPath}.tmp.${process.pid}`;
|
|
141
|
+
const content = JSON.stringify(manifest, null, 2) + "\n";
|
|
142
|
+
fs.writeFileSync(tmpPath, content);
|
|
143
|
+
fs.renameSync(tmpPath, destPath);
|
|
144
|
+
}
|
|
145
|
+
async function installFromMarketplace(source, sourceType, config, logger) {
|
|
146
|
+
const _log = logger ?? {
|
|
147
|
+
info: (msg) => log.info(`[marketplace] ${msg}`),
|
|
148
|
+
warn: (msg) => log.warn(`[marketplace] ${msg}`),
|
|
149
|
+
debug: (msg) => log.debug(`[marketplace] ${msg}`)
|
|
150
|
+
};
|
|
151
|
+
if (!config.codexMarketplaceEnabled) {
|
|
152
|
+
return {
|
|
153
|
+
ok: false,
|
|
154
|
+
message: "Codex marketplace is disabled in config (codexMarketplaceEnabled: false)",
|
|
155
|
+
source,
|
|
156
|
+
sourceType,
|
|
157
|
+
pluginsFound: [],
|
|
158
|
+
errors: ["marketplace_disabled"]
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
const manifest = await resolveManifest(source, sourceType, _log);
|
|
163
|
+
const pluginNames = manifest.plugins.map((p) => p.name);
|
|
164
|
+
_log.info(`marketplace install: found ${pluginNames.length} plugin(s) from ${sourceType}://${source}`);
|
|
165
|
+
return {
|
|
166
|
+
ok: true,
|
|
167
|
+
message: `Successfully resolved ${pluginNames.length} plugin(s) from marketplace: ${pluginNames.join(", ")}`,
|
|
168
|
+
source,
|
|
169
|
+
sourceType,
|
|
170
|
+
pluginsFound: pluginNames,
|
|
171
|
+
errors: []
|
|
172
|
+
};
|
|
173
|
+
} catch (err) {
|
|
174
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
175
|
+
_log.warn(`marketplace install failed: ${errMsg}`);
|
|
176
|
+
return {
|
|
177
|
+
ok: false,
|
|
178
|
+
message: `Failed to install from marketplace: ${errMsg}`,
|
|
179
|
+
source,
|
|
180
|
+
sourceType,
|
|
181
|
+
pluginsFound: [],
|
|
182
|
+
errors: [errMsg]
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async function resolveManifest(source, sourceType, logger) {
|
|
187
|
+
switch (sourceType) {
|
|
188
|
+
case "local":
|
|
189
|
+
return resolveLocal(source, logger);
|
|
190
|
+
case "url":
|
|
191
|
+
return resolveUrl(source, logger);
|
|
192
|
+
case "github":
|
|
193
|
+
return resolveGithub(source, logger);
|
|
194
|
+
case "git":
|
|
195
|
+
return resolveGit(source, logger);
|
|
196
|
+
default: {
|
|
197
|
+
const _ = sourceType;
|
|
198
|
+
throw new Error(`Invalid source type: ${String(_)}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function resolveLocal(dirPath, logger) {
|
|
203
|
+
const manifestPath = path.join(dirPath, MARKETPLACE_MANIFEST_FILENAME);
|
|
204
|
+
if (!fs.existsSync(manifestPath)) {
|
|
205
|
+
throw new Error(`marketplace.json not found at ${manifestPath}`);
|
|
206
|
+
}
|
|
207
|
+
logger.debug?.(`reading local marketplace manifest: ${manifestPath}`);
|
|
208
|
+
const raw = fs.readFileSync(manifestPath, "utf-8");
|
|
209
|
+
let parsed;
|
|
210
|
+
try {
|
|
211
|
+
parsed = JSON.parse(raw);
|
|
212
|
+
} catch {
|
|
213
|
+
throw new Error(`Invalid JSON in ${manifestPath}`);
|
|
214
|
+
}
|
|
215
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
216
|
+
throw new Error(`marketplace.json at ${manifestPath} is not a valid object`);
|
|
217
|
+
}
|
|
218
|
+
return validateMarketplaceManifest(parsed);
|
|
219
|
+
}
|
|
220
|
+
async function resolveUrl(url, logger) {
|
|
221
|
+
logger.debug?.(`fetching marketplace manifest from URL: ${url}`);
|
|
222
|
+
let parsedUrl;
|
|
223
|
+
try {
|
|
224
|
+
parsedUrl = new URL(url);
|
|
225
|
+
} catch {
|
|
226
|
+
throw new Error(`Invalid URL: ${url}`);
|
|
227
|
+
}
|
|
228
|
+
if (parsedUrl.protocol !== "https:" && parsedUrl.protocol !== "http:") {
|
|
229
|
+
throw new Error(`Unsupported URL protocol: ${parsedUrl.protocol} (use https or http)`);
|
|
230
|
+
}
|
|
231
|
+
const response = await fetch(url);
|
|
232
|
+
if (!response.ok) {
|
|
233
|
+
throw new Error(`HTTP ${response.status} fetching ${url}`);
|
|
234
|
+
}
|
|
235
|
+
const body = await response.json();
|
|
236
|
+
return validateMarketplaceManifest(body);
|
|
237
|
+
}
|
|
238
|
+
async function resolveGithub(repo, logger) {
|
|
239
|
+
if (!/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/u.test(repo)) {
|
|
240
|
+
throw new Error(`Invalid GitHub repo format: "${repo}" (expected owner/repo)`);
|
|
241
|
+
}
|
|
242
|
+
const rawUrl = `https://raw.githubusercontent.com/${repo}/HEAD/${MARKETPLACE_MANIFEST_FILENAME}`;
|
|
243
|
+
logger.debug?.(`fetching marketplace manifest from GitHub: ${rawUrl}`);
|
|
244
|
+
return resolveUrl(rawUrl, logger);
|
|
245
|
+
}
|
|
246
|
+
async function resolveGit(gitUrl, logger) {
|
|
247
|
+
const ghMatch = gitUrl.match(
|
|
248
|
+
/^(?:https?:\/\/)?github\.com\/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+?)(?:\.git)?$/u
|
|
249
|
+
);
|
|
250
|
+
if (ghMatch?.[1]) {
|
|
251
|
+
logger.debug?.(`git URL looks like GitHub \u2014 delegating to github resolver`);
|
|
252
|
+
return resolveGithub(ghMatch[1], logger);
|
|
253
|
+
}
|
|
254
|
+
throw new Error(
|
|
255
|
+
`Git URL resolution requires a GitHub-format URL for now. Got: ${gitUrl}. Use --type github or --type url instead.`
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
function readPackageVersion() {
|
|
259
|
+
const candidates = [
|
|
260
|
+
path.resolve(import.meta.dirname ?? ".", "../../../.."),
|
|
261
|
+
path.resolve(import.meta.dirname ?? ".", "../../../../.."),
|
|
262
|
+
path.resolve(import.meta.dirname ?? ".", "..")
|
|
263
|
+
];
|
|
264
|
+
for (const candidate of candidates) {
|
|
265
|
+
const pkgPath = path.join(candidate, "package.json");
|
|
266
|
+
try {
|
|
267
|
+
if (!fs.existsSync(pkgPath)) continue;
|
|
268
|
+
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
269
|
+
const parsed = JSON.parse(raw);
|
|
270
|
+
if (typeof parsed === "object" && parsed !== null && typeof parsed.version === "string") {
|
|
271
|
+
return parsed.version;
|
|
272
|
+
}
|
|
273
|
+
} catch {
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return void 0;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// src/connectors/index.ts
|
|
280
|
+
var BUILTIN_CONNECTORS = [
|
|
281
|
+
{
|
|
282
|
+
id: "claude-code",
|
|
283
|
+
name: "Claude Code",
|
|
284
|
+
version: "1.0.0",
|
|
285
|
+
description: "Anthropic's Claude Code CLI \u2014 direct memory access via MCP",
|
|
286
|
+
capabilities: {
|
|
287
|
+
observe: true,
|
|
288
|
+
recall: true,
|
|
289
|
+
store: true,
|
|
290
|
+
search: true,
|
|
291
|
+
entities: true,
|
|
292
|
+
realtimeSync: true,
|
|
293
|
+
batch: false,
|
|
294
|
+
maxBudgetChars: 32e3,
|
|
295
|
+
connectionType: "mcp"
|
|
296
|
+
},
|
|
297
|
+
configSchema: {
|
|
298
|
+
mcpServerUrl: "URL of the MCP Remnic server",
|
|
299
|
+
namespace: "Optional namespace (default: 'default')"
|
|
300
|
+
},
|
|
301
|
+
homepage: "https://claude.ai/code",
|
|
302
|
+
author: "Anthropic",
|
|
303
|
+
tags: ["official", "ai", "claude"],
|
|
304
|
+
requiresToken: true
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
id: "codex-cli",
|
|
308
|
+
name: "Codex CLI",
|
|
309
|
+
version: "1.0.0",
|
|
310
|
+
description: "OpenAI Codex CLI \u2014 memory via MCP tool",
|
|
311
|
+
capabilities: {
|
|
312
|
+
observe: true,
|
|
313
|
+
recall: true,
|
|
314
|
+
store: true,
|
|
315
|
+
search: false,
|
|
316
|
+
entities: false,
|
|
317
|
+
realtimeSync: false,
|
|
318
|
+
batch: true,
|
|
319
|
+
maxBudgetChars: 8e3,
|
|
320
|
+
connectionType: "mcp"
|
|
321
|
+
},
|
|
322
|
+
configSchema: {
|
|
323
|
+
mcpServerUrl: "URL of the MCP Remnic server",
|
|
324
|
+
namespace: "Optional namespace"
|
|
325
|
+
},
|
|
326
|
+
homepage: "https://openai.com/codex",
|
|
327
|
+
author: "OpenAI",
|
|
328
|
+
tags: ["official", "ai", "codex"],
|
|
329
|
+
requiresToken: true
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
id: "cursor",
|
|
333
|
+
name: "Cursor IDE",
|
|
334
|
+
version: "1.0.0",
|
|
335
|
+
description: "Cursor IDE \u2014 memory via config file + tool calls",
|
|
336
|
+
capabilities: {
|
|
337
|
+
observe: false,
|
|
338
|
+
recall: true,
|
|
339
|
+
store: false,
|
|
340
|
+
search: true,
|
|
341
|
+
entities: false,
|
|
342
|
+
realtimeSync: false,
|
|
343
|
+
batch: false,
|
|
344
|
+
maxBudgetChars: 32e3,
|
|
345
|
+
connectionType: "embedded"
|
|
346
|
+
},
|
|
347
|
+
configSchema: {
|
|
348
|
+
memoryDir: "Path to Remnic memory directory"
|
|
349
|
+
},
|
|
350
|
+
homepage: "https://cursor.com",
|
|
351
|
+
author: "Cursor Inc.",
|
|
352
|
+
tags: ["official", "ide"]
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
id: "cline",
|
|
356
|
+
name: "Cline",
|
|
357
|
+
version: "1.0.0",
|
|
358
|
+
description: "VS Code Cline extension \u2014 memory via MCP",
|
|
359
|
+
capabilities: {
|
|
360
|
+
observe: true,
|
|
361
|
+
recall: true,
|
|
362
|
+
store: true,
|
|
363
|
+
search: false,
|
|
364
|
+
entities: false,
|
|
365
|
+
realtimeSync: false,
|
|
366
|
+
batch: true,
|
|
367
|
+
maxBudgetChars: 8e3,
|
|
368
|
+
connectionType: "mcp"
|
|
369
|
+
},
|
|
370
|
+
configSchema: {
|
|
371
|
+
mcpServerUrl: "URL of the MCP Remnic server",
|
|
372
|
+
namespace: "Optional namespace"
|
|
373
|
+
},
|
|
374
|
+
homepage: "https://github.com/cline/cline",
|
|
375
|
+
author: "Cline",
|
|
376
|
+
tags: ["community", "vscode"]
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
id: "github-copilot",
|
|
380
|
+
name: "GitHub Copilot",
|
|
381
|
+
version: "1.0.0",
|
|
382
|
+
description: "GitHub Copilot \u2014 memory via MCP server",
|
|
383
|
+
capabilities: {
|
|
384
|
+
observe: false,
|
|
385
|
+
recall: true,
|
|
386
|
+
store: false,
|
|
387
|
+
search: true,
|
|
388
|
+
entities: false,
|
|
389
|
+
realtimeSync: false,
|
|
390
|
+
batch: false,
|
|
391
|
+
maxBudgetChars: 16e3,
|
|
392
|
+
connectionType: "mcp"
|
|
393
|
+
},
|
|
394
|
+
configSchema: {
|
|
395
|
+
mcpServerUrl: "URL of the MCP Remnic server"
|
|
396
|
+
},
|
|
397
|
+
homepage: "https://github.com/features/copilot",
|
|
398
|
+
author: "GitHub",
|
|
399
|
+
tags: ["official", "ai", "github"]
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
id: "roo-code",
|
|
403
|
+
name: "Roo Code",
|
|
404
|
+
version: "1.0.0",
|
|
405
|
+
description: "Roo Code \u2014 memory via MCP",
|
|
406
|
+
capabilities: {
|
|
407
|
+
observe: true,
|
|
408
|
+
recall: true,
|
|
409
|
+
store: true,
|
|
410
|
+
search: false,
|
|
411
|
+
entities: false,
|
|
412
|
+
realtimeSync: false,
|
|
413
|
+
batch: true,
|
|
414
|
+
maxBudgetChars: 16e3,
|
|
415
|
+
connectionType: "mcp"
|
|
416
|
+
},
|
|
417
|
+
configSchema: {
|
|
418
|
+
mcpServerUrl: "URL of the MCP Remnic server",
|
|
419
|
+
namespace: "Optional namespace"
|
|
420
|
+
},
|
|
421
|
+
homepage: "https://roocode.com",
|
|
422
|
+
author: "Roo Code",
|
|
423
|
+
tags: ["community", "vscode"]
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
id: "windsurf",
|
|
427
|
+
name: "Windsurf",
|
|
428
|
+
version: "1.0.0",
|
|
429
|
+
description: "Windsurf IDE \u2014 memory via MCP",
|
|
430
|
+
capabilities: {
|
|
431
|
+
observe: true,
|
|
432
|
+
recall: true,
|
|
433
|
+
store: true,
|
|
434
|
+
search: true,
|
|
435
|
+
entities: false,
|
|
436
|
+
realtimeSync: false,
|
|
437
|
+
batch: false,
|
|
438
|
+
maxBudgetChars: 32e3,
|
|
439
|
+
connectionType: "mcp"
|
|
440
|
+
},
|
|
441
|
+
configSchema: {
|
|
442
|
+
mcpServerUrl: "URL of the MCP Remnic server"
|
|
443
|
+
},
|
|
444
|
+
homepage: "https://windsurf.com",
|
|
445
|
+
author: "Codeium",
|
|
446
|
+
tags: ["official", "ide"]
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
id: "amp",
|
|
450
|
+
name: "Amp",
|
|
451
|
+
version: "1.0.0",
|
|
452
|
+
description: "Amp coding agent \u2014 memory via MCP",
|
|
453
|
+
capabilities: {
|
|
454
|
+
observe: true,
|
|
455
|
+
recall: true,
|
|
456
|
+
store: true,
|
|
457
|
+
search: true,
|
|
458
|
+
entities: false,
|
|
459
|
+
realtimeSync: false,
|
|
460
|
+
batch: false,
|
|
461
|
+
maxBudgetChars: 32e3,
|
|
462
|
+
connectionType: "mcp"
|
|
463
|
+
},
|
|
464
|
+
configSchema: {
|
|
465
|
+
mcpServerUrl: "URL of the MCP Remnic server"
|
|
466
|
+
},
|
|
467
|
+
homepage: "https://ampcode.com",
|
|
468
|
+
author: "Sourcegraph",
|
|
469
|
+
tags: ["official", "ai"]
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
id: "pi",
|
|
473
|
+
name: "Pi Coding Agent",
|
|
474
|
+
version: "1.0.0",
|
|
475
|
+
description: "Pi Coding Agent \u2014 native extension for recall, observe, MCP tools, and compaction coordination",
|
|
476
|
+
capabilities: {
|
|
477
|
+
observe: true,
|
|
478
|
+
recall: true,
|
|
479
|
+
store: true,
|
|
480
|
+
search: true,
|
|
481
|
+
entities: true,
|
|
482
|
+
realtimeSync: true,
|
|
483
|
+
batch: true,
|
|
484
|
+
maxBudgetChars: 32e3,
|
|
485
|
+
connectionType: "http"
|
|
486
|
+
},
|
|
487
|
+
configSchema: {
|
|
488
|
+
remnicDaemonUrl: "URL of the Remnic daemon (default: http://127.0.0.1:4318)",
|
|
489
|
+
namespace: "Optional namespace",
|
|
490
|
+
installExtension: "Install the Pi extension into ~/.pi/agent/extensions/remnic (default: true)"
|
|
491
|
+
},
|
|
492
|
+
homepage: "https://pi.dev",
|
|
493
|
+
author: "Remnic",
|
|
494
|
+
tags: ["official", "ai", "pi", "coding-agent"],
|
|
495
|
+
requiresToken: true
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
id: "replit",
|
|
499
|
+
name: "Replit Agent",
|
|
500
|
+
version: "1.0.0",
|
|
501
|
+
description: "Replit Agent \u2014 memory via HTTP API (reduced capabilities)",
|
|
502
|
+
capabilities: {
|
|
503
|
+
observe: true,
|
|
504
|
+
recall: true,
|
|
505
|
+
store: true,
|
|
506
|
+
search: false,
|
|
507
|
+
entities: false,
|
|
508
|
+
realtimeSync: false,
|
|
509
|
+
batch: false,
|
|
510
|
+
maxBudgetChars: 8e3,
|
|
511
|
+
connectionType: "http"
|
|
512
|
+
},
|
|
513
|
+
configSchema: {
|
|
514
|
+
apiUrl: "URL of the Remnic HTTP API",
|
|
515
|
+
authToken: "Bearer token for authentication"
|
|
516
|
+
},
|
|
517
|
+
homepage: "https://replit.com",
|
|
518
|
+
author: "Replit",
|
|
519
|
+
tags: ["official", "cloud"],
|
|
520
|
+
requiresToken: true
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
id: "generic-mcp",
|
|
524
|
+
name: "Generic MCP Client",
|
|
525
|
+
version: "1.0.0",
|
|
526
|
+
description: "Any MCP-compatible client \u2014 connect via standard MCP protocol",
|
|
527
|
+
capabilities: {
|
|
528
|
+
observe: true,
|
|
529
|
+
recall: true,
|
|
530
|
+
store: true,
|
|
531
|
+
search: true,
|
|
532
|
+
entities: true,
|
|
533
|
+
realtimeSync: true,
|
|
534
|
+
batch: true,
|
|
535
|
+
maxBudgetChars: 64e3,
|
|
536
|
+
connectionType: "mcp"
|
|
537
|
+
},
|
|
538
|
+
configSchema: {
|
|
539
|
+
mcpServerUrl: "URL of the MCP Remnic server",
|
|
540
|
+
namespace: "Optional namespace",
|
|
541
|
+
authToken: "Bearer token for authentication"
|
|
542
|
+
},
|
|
543
|
+
homepage: "https://github.com/joshuaswarren/remnic",
|
|
544
|
+
author: "Remnic",
|
|
545
|
+
tags: ["generic", "mcp"],
|
|
546
|
+
requiresToken: true
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
id: "weclone",
|
|
550
|
+
name: "WeClone Avatar",
|
|
551
|
+
version: "1.0.0",
|
|
552
|
+
description: "Memory-aware OpenAI-compatible proxy for deployed WeClone avatars \u2014 injects Remnic recall into chat completions and buffers turns via observe",
|
|
553
|
+
capabilities: {
|
|
554
|
+
observe: true,
|
|
555
|
+
recall: true,
|
|
556
|
+
store: false,
|
|
557
|
+
search: false,
|
|
558
|
+
entities: false,
|
|
559
|
+
realtimeSync: false,
|
|
560
|
+
batch: false,
|
|
561
|
+
maxBudgetChars: 32e3,
|
|
562
|
+
connectionType: "http"
|
|
563
|
+
},
|
|
564
|
+
configSchema: {
|
|
565
|
+
wecloneApiUrl: "Base URL of the WeClone OpenAI-compatible API (e.g. http://localhost:8000/v1)",
|
|
566
|
+
proxyPort: "Local port where the memory proxy will listen (default 8100)",
|
|
567
|
+
remnicDaemonUrl: "URL of the Remnic daemon exposing /engram/v1/recall and /engram/v1/observe",
|
|
568
|
+
sessionStrategy: "Per-caller session mapping strategy: 'caller-id' | 'single'",
|
|
569
|
+
wecloneModelName: "Optional fine-tuned model name passed through to WeClone"
|
|
570
|
+
},
|
|
571
|
+
homepage: "https://github.com/xming521/weclone",
|
|
572
|
+
author: "Remnic",
|
|
573
|
+
tags: ["official", "ai", "weclone", "proxy"],
|
|
574
|
+
requiresToken: true
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
id: "hermes",
|
|
578
|
+
name: "Hermes Agent",
|
|
579
|
+
version: "1.0.0",
|
|
580
|
+
description: "Hermes Agent MemoryProvider \u2014 automatic recall/observe on every turn via Python plugin protocol",
|
|
581
|
+
capabilities: {
|
|
582
|
+
observe: true,
|
|
583
|
+
recall: true,
|
|
584
|
+
store: true,
|
|
585
|
+
search: true,
|
|
586
|
+
entities: false,
|
|
587
|
+
realtimeSync: true,
|
|
588
|
+
batch: false,
|
|
589
|
+
maxBudgetChars: 32e3,
|
|
590
|
+
connectionType: "http"
|
|
591
|
+
},
|
|
592
|
+
configSchema: {
|
|
593
|
+
host: "Remnic daemon host (default: 127.0.0.1)",
|
|
594
|
+
port: "Remnic daemon port (default: 4318)",
|
|
595
|
+
profile: "Hermes profile name (default: default)"
|
|
596
|
+
},
|
|
597
|
+
homepage: "https://github.com/joshuaswarren/remnic/tree/main/packages/plugin-hermes",
|
|
598
|
+
author: "Remnic",
|
|
599
|
+
tags: ["official", "python", "hermes"],
|
|
600
|
+
requiresToken: true
|
|
601
|
+
}
|
|
602
|
+
];
|
|
603
|
+
var REGISTRY_DIR_NAME = ".engram-connectors";
|
|
604
|
+
function getRegistryPath() {
|
|
605
|
+
const xdgConfigHome = readEnvVar("XDG_CONFIG_HOME");
|
|
606
|
+
const configDir = xdgConfigHome ? path2.join(xdgConfigHome, "engram") : path2.join(resolveHomeDir(), ".config", "engram");
|
|
607
|
+
return path2.join(configDir, REGISTRY_DIR_NAME, "registry.json");
|
|
608
|
+
}
|
|
609
|
+
function loadRegistry() {
|
|
610
|
+
const regPath = getRegistryPath();
|
|
611
|
+
if (!fs2.existsSync(regPath)) {
|
|
612
|
+
const registry = {
|
|
613
|
+
connectors: BUILTIN_CONNECTORS,
|
|
614
|
+
registryPath: regPath
|
|
615
|
+
};
|
|
616
|
+
saveRegistry(registry);
|
|
617
|
+
return registry;
|
|
618
|
+
}
|
|
619
|
+
const raw = fs2.readFileSync(regPath, "utf8");
|
|
620
|
+
try {
|
|
621
|
+
const parsed = JSON.parse(raw);
|
|
622
|
+
const builtinIds = new Set(BUILTIN_CONNECTORS.map((b) => b.id));
|
|
623
|
+
const customOnly = (parsed.connectors ?? []).filter((c) => !builtinIds.has(c.id));
|
|
624
|
+
const merged = [...BUILTIN_CONNECTORS, ...customOnly];
|
|
625
|
+
return {
|
|
626
|
+
connectors: merged,
|
|
627
|
+
registryPath: regPath
|
|
628
|
+
};
|
|
629
|
+
} catch {
|
|
630
|
+
const registry = {
|
|
631
|
+
connectors: BUILTIN_CONNECTORS,
|
|
632
|
+
registryPath: regPath
|
|
633
|
+
};
|
|
634
|
+
saveRegistry(registry);
|
|
635
|
+
return registry;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function saveRegistry(registry) {
|
|
639
|
+
const regPath = registry.registryPath;
|
|
640
|
+
fs2.mkdirSync(path2.dirname(regPath), { recursive: true });
|
|
641
|
+
fs2.writeFileSync(regPath, JSON.stringify({ connectors: registry.connectors }, null, 2));
|
|
642
|
+
}
|
|
643
|
+
function listConnectors() {
|
|
644
|
+
const registry = loadRegistry();
|
|
645
|
+
const connectorsDir = getConnectorsDir();
|
|
646
|
+
const installedIds = /* @__PURE__ */ new Set();
|
|
647
|
+
if (fs2.existsSync(connectorsDir)) {
|
|
648
|
+
for (const entry of fs2.readdirSync(connectorsDir)) {
|
|
649
|
+
if (entry.endsWith(".json")) {
|
|
650
|
+
try {
|
|
651
|
+
const config = JSON.parse(
|
|
652
|
+
fs2.readFileSync(path2.join(connectorsDir, entry), "utf8")
|
|
653
|
+
);
|
|
654
|
+
installedIds.add(config.connectorId);
|
|
655
|
+
} catch {
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
const available = registry.connectors.map((manifest) => ({
|
|
661
|
+
...manifest,
|
|
662
|
+
installed: installedIds.has(manifest.id)
|
|
663
|
+
}));
|
|
664
|
+
const installed = [];
|
|
665
|
+
for (const id of installedIds) {
|
|
666
|
+
const configPath = path2.join(connectorsDir, `${id}.json`);
|
|
667
|
+
try {
|
|
668
|
+
const raw = JSON.parse(fs2.readFileSync(configPath, "utf8"));
|
|
669
|
+
const { token: _redacted, ...config } = raw;
|
|
670
|
+
installed.push({
|
|
671
|
+
connectorId: id,
|
|
672
|
+
config,
|
|
673
|
+
status: "installed",
|
|
674
|
+
installedAt: raw.installedAt
|
|
675
|
+
});
|
|
676
|
+
} catch {
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
return { installed, available };
|
|
680
|
+
}
|
|
681
|
+
function getConnectorToken(connectorId) {
|
|
682
|
+
try {
|
|
683
|
+
return loadTokenStore().tokens.find((t) => t.connector === connectorId)?.token;
|
|
684
|
+
} catch {
|
|
685
|
+
return void 0;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
function readSavedConnectorConfig(configPath) {
|
|
689
|
+
if (!fs2.existsSync(configPath)) return {};
|
|
690
|
+
try {
|
|
691
|
+
const parsed = JSON.parse(fs2.readFileSync(configPath, "utf8"));
|
|
692
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
693
|
+
const {
|
|
694
|
+
connectorId: _connectorId,
|
|
695
|
+
installedAt: _installedAt,
|
|
696
|
+
token: _token,
|
|
697
|
+
...config
|
|
698
|
+
} = parsed;
|
|
699
|
+
return config;
|
|
700
|
+
} catch {
|
|
701
|
+
return {};
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
function removeClearedSavedConnectorConfig(savedConnectorConfig, rawUserConfig) {
|
|
705
|
+
const merged = { ...savedConnectorConfig };
|
|
706
|
+
for (const [key, value] of Object.entries(rawUserConfig)) {
|
|
707
|
+
if (value === void 0 || value === null || value === "") {
|
|
708
|
+
delete merged[key];
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return merged;
|
|
712
|
+
}
|
|
713
|
+
function compactConnectorConfigOverrides(rawUserConfig) {
|
|
714
|
+
const safeUserConfig = {};
|
|
715
|
+
for (const [key, value] of Object.entries(rawUserConfig)) {
|
|
716
|
+
if (value === void 0 || value === null || value === "") continue;
|
|
717
|
+
safeUserConfig[key] = value;
|
|
718
|
+
}
|
|
719
|
+
return safeUserConfig;
|
|
720
|
+
}
|
|
721
|
+
function installConnector(options) {
|
|
722
|
+
const registry = loadRegistry();
|
|
723
|
+
const manifest = registry.connectors.find((c) => c.id === options.connectorId);
|
|
724
|
+
if (!manifest) {
|
|
725
|
+
return {
|
|
726
|
+
connectorId: options.connectorId,
|
|
727
|
+
status: "error",
|
|
728
|
+
message: `Unknown connector: ${options.connectorId}`
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
const existing = listConnectors().installed.find(
|
|
732
|
+
(c) => c.connectorId === options.connectorId
|
|
733
|
+
);
|
|
734
|
+
if (existing && !options.force) {
|
|
735
|
+
return {
|
|
736
|
+
connectorId: options.connectorId,
|
|
737
|
+
status: "already_installed",
|
|
738
|
+
message: "Already installed. Use --force to reinstall."
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
const configDir = getConnectorsDir();
|
|
742
|
+
fs2.mkdirSync(configDir, { recursive: true });
|
|
743
|
+
const configPath = path2.join(configDir, `${options.connectorId}.json`);
|
|
744
|
+
const savedConnectorConfig = existing ? readSavedConnectorConfig(configPath) : {};
|
|
745
|
+
let hermesSavedProfile;
|
|
746
|
+
let hermesSavedHost;
|
|
747
|
+
let hermesSavedPort;
|
|
748
|
+
let hermesResolvedProfile;
|
|
749
|
+
let hermesResolvedHost;
|
|
750
|
+
let hermesResolvedPort;
|
|
751
|
+
if (options.connectorId === "hermes") {
|
|
752
|
+
if (fs2.existsSync(configPath)) {
|
|
753
|
+
try {
|
|
754
|
+
const prev = JSON.parse(fs2.readFileSync(configPath, "utf8"));
|
|
755
|
+
if (prev?.profile != null) {
|
|
756
|
+
try {
|
|
757
|
+
hermesSavedProfile = sanitizeHermesProfile(String(prev.profile));
|
|
758
|
+
} catch {
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
if (prev?.host != null) {
|
|
762
|
+
try {
|
|
763
|
+
hermesSavedHost = sanitizeHermesHost(String(prev.host));
|
|
764
|
+
} catch {
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
if (prev?.port != null) {
|
|
768
|
+
try {
|
|
769
|
+
const coercedPort = Number(String(prev.port));
|
|
770
|
+
hermesSavedPort = sanitizeHermesPort(coercedPort);
|
|
771
|
+
} catch {
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
} catch {
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
hermesResolvedProfile = hermesSavedProfile ?? "default";
|
|
778
|
+
hermesResolvedHost = hermesSavedHost ?? "127.0.0.1";
|
|
779
|
+
if (options.config?.port !== void 0) {
|
|
780
|
+
try {
|
|
781
|
+
hermesResolvedPort = sanitizeHermesPort(Number(String(options.config.port)));
|
|
782
|
+
} catch (err) {
|
|
783
|
+
return {
|
|
784
|
+
connectorId: options.connectorId,
|
|
785
|
+
status: "error",
|
|
786
|
+
message: `Invalid Hermes config: ${err instanceof Error ? err.message : String(err)}`
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
if (hermesResolvedPort === void 0) {
|
|
791
|
+
hermesResolvedPort = hermesSavedPort ?? 4318;
|
|
792
|
+
}
|
|
793
|
+
if (options.config?.profile !== void 0) {
|
|
794
|
+
try {
|
|
795
|
+
hermesResolvedProfile = sanitizeHermesProfile(String(options.config.profile));
|
|
796
|
+
} catch (err) {
|
|
797
|
+
return {
|
|
798
|
+
connectorId: options.connectorId,
|
|
799
|
+
status: "error",
|
|
800
|
+
message: `Invalid Hermes config: ${err instanceof Error ? err.message : String(err)}`
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
if (options.config?.host !== void 0) {
|
|
805
|
+
try {
|
|
806
|
+
hermesResolvedHost = sanitizeHermesHost(String(options.config.host));
|
|
807
|
+
} catch (err) {
|
|
808
|
+
return {
|
|
809
|
+
connectorId: options.connectorId,
|
|
810
|
+
status: "error",
|
|
811
|
+
message: `Invalid Hermes config: ${err instanceof Error ? err.message : String(err)}`
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
const nonHermesPriorTokenStore = options.connectorId !== "hermes" && manifest.requiresToken ? loadTokenStore() : null;
|
|
817
|
+
let tokenEntry = null;
|
|
818
|
+
if (options.connectorId === "hermes") {
|
|
819
|
+
try {
|
|
820
|
+
tokenEntry = buildTokenEntry(options.connectorId);
|
|
821
|
+
} catch {
|
|
822
|
+
}
|
|
823
|
+
} else if (manifest.requiresToken) {
|
|
824
|
+
try {
|
|
825
|
+
tokenEntry = generateToken(options.connectorId);
|
|
826
|
+
} catch {
|
|
827
|
+
if (nonHermesPriorTokenStore !== null) {
|
|
828
|
+
try {
|
|
829
|
+
saveTokenStore(nonHermesPriorTokenStore);
|
|
830
|
+
} catch {
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
if (options.connectorId !== "hermes" && manifest.requiresToken && tokenEntry === null) {
|
|
836
|
+
return {
|
|
837
|
+
connectorId: options.connectorId,
|
|
838
|
+
status: "error",
|
|
839
|
+
message: `${manifest.name} install aborted: token generation failed. Run \`remnic token generate ${options.connectorId}\` to create the token, then reinstall.`
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
const { token: _callerToken, ...rawUserConfig } = options.config ?? {};
|
|
843
|
+
const savedConnectorConfigForMerge = removeClearedSavedConnectorConfig(savedConnectorConfig, rawUserConfig);
|
|
844
|
+
const safeUserConfig = compactConnectorConfigOverrides(rawUserConfig);
|
|
845
|
+
const resolvedConfig = {
|
|
846
|
+
...savedConnectorConfigForMerge,
|
|
847
|
+
...safeUserConfig,
|
|
848
|
+
connectorId: options.connectorId,
|
|
849
|
+
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
850
|
+
// For hermes, always overlay the sanitized/coerced resolved values so that
|
|
851
|
+
// the connector JSON always has a numeric port and validated profile/host.
|
|
852
|
+
// This also ensures options.config string values (from --config=port=5555)
|
|
853
|
+
// are replaced with their sanitized numeric equivalents (Fix 2 root cause).
|
|
854
|
+
...hermesResolvedProfile !== void 0 ? {
|
|
855
|
+
profile: hermesResolvedProfile,
|
|
856
|
+
host: hermesResolvedHost,
|
|
857
|
+
port: hermesResolvedPort
|
|
858
|
+
} : {}
|
|
859
|
+
};
|
|
860
|
+
if (options.connectorId === "hermes") {
|
|
861
|
+
const rawProfile = hermesResolvedProfile;
|
|
862
|
+
const hermesHost = hermesResolvedHost;
|
|
863
|
+
const hermesPort = hermesResolvedPort;
|
|
864
|
+
let hermesProfile;
|
|
865
|
+
try {
|
|
866
|
+
hermesProfile = sanitizeHermesProfile(rawProfile);
|
|
867
|
+
} catch (err) {
|
|
868
|
+
return {
|
|
869
|
+
connectorId: options.connectorId,
|
|
870
|
+
status: "error",
|
|
871
|
+
message: `Hermes install aborted: ${err instanceof Error ? err.message : String(err)}`
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
if (!tokenEntry) {
|
|
875
|
+
return {
|
|
876
|
+
connectorId: options.connectorId,
|
|
877
|
+
status: "error",
|
|
878
|
+
message: "Hermes install aborted: token store unavailable. Run `remnic token generate hermes` then reinstall to complete setup."
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
let yamlResult;
|
|
882
|
+
try {
|
|
883
|
+
yamlResult = upsertHermesConfig({
|
|
884
|
+
profile: hermesProfile,
|
|
885
|
+
host: hermesHost,
|
|
886
|
+
port: hermesPort,
|
|
887
|
+
token: tokenEntry.token
|
|
888
|
+
});
|
|
889
|
+
} catch (err) {
|
|
890
|
+
return {
|
|
891
|
+
connectorId: options.connectorId,
|
|
892
|
+
status: "error",
|
|
893
|
+
message: `Hermes install aborted: config.yaml write failed \u2014 ${err instanceof Error ? err.message : String(err)}`
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
if (!yamlResult.updated) {
|
|
897
|
+
return {
|
|
898
|
+
connectorId: options.connectorId,
|
|
899
|
+
status: "error",
|
|
900
|
+
message: `Hermes install aborted: ${yamlResult.reason ?? "config.yaml not written"}. Create the Hermes profile directory first, then reinstall.`
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
const priorTokenStore = loadTokenStore();
|
|
904
|
+
let committed = false;
|
|
905
|
+
try {
|
|
906
|
+
commitTokenEntry(tokenEntry);
|
|
907
|
+
committed = true;
|
|
908
|
+
} catch (commitErr) {
|
|
909
|
+
let tokensRolledBack = true;
|
|
910
|
+
let tokensRollbackErrMsg = "";
|
|
911
|
+
try {
|
|
912
|
+
saveTokenStore(priorTokenStore);
|
|
913
|
+
} catch (tokenRestoreErr) {
|
|
914
|
+
tokensRolledBack = false;
|
|
915
|
+
tokensRollbackErrMsg = tokenRestoreErr instanceof Error ? tokenRestoreErr.message : String(tokenRestoreErr);
|
|
916
|
+
}
|
|
917
|
+
let yamlRolledBack = true;
|
|
918
|
+
let yamlRollbackErrMsg = "";
|
|
919
|
+
try {
|
|
920
|
+
if (yamlResult.priorContent === null) {
|
|
921
|
+
fs2.unlinkSync(yamlResult.configPath);
|
|
922
|
+
} else if (typeof yamlResult.priorContent === "string") {
|
|
923
|
+
writeSecretFileSync(yamlResult.configPath, yamlResult.priorContent);
|
|
924
|
+
}
|
|
925
|
+
} catch (yamlRestoreErr) {
|
|
926
|
+
yamlRolledBack = false;
|
|
927
|
+
yamlRollbackErrMsg = yamlRestoreErr instanceof Error ? yamlRestoreErr.message : String(yamlRestoreErr);
|
|
928
|
+
}
|
|
929
|
+
const commitErrMsg = commitErr instanceof Error ? commitErr.message : String(commitErr);
|
|
930
|
+
let message;
|
|
931
|
+
if (tokensRolledBack && yamlRolledBack) {
|
|
932
|
+
message = `Hermes install failed during token commit \u2014 ${commitErrMsg}. config.yaml and tokens.json restored to prior state. Resolve the tokens.json access issue, then reinstall.`;
|
|
933
|
+
} else if (!yamlRolledBack && tokensRolledBack) {
|
|
934
|
+
message = `Hermes install failed during token commit \u2014 ${commitErrMsg}. tokens.json restored but config.yaml rollback ALSO failed (${yamlRollbackErrMsg}). Hermes daemon may be in an inconsistent state: config references a stale token. Manually inspect ${yamlResult.configPath} and reinstall.`;
|
|
935
|
+
} else if (yamlRolledBack && !tokensRolledBack) {
|
|
936
|
+
message = `Hermes install failed during token commit \u2014 ${commitErrMsg}. config.yaml restored but tokens.json rollback ALSO failed (${tokensRollbackErrMsg}). Hermes daemon may be in an inconsistent state: tokens.json is corrupt or incomplete. Manually inspect ~/.remnic/tokens.json and reinstall.`;
|
|
937
|
+
} else {
|
|
938
|
+
message = `Hermes install failed during token commit \u2014 ${commitErrMsg}. BOTH rollbacks failed: config.yaml rollback failed (${yamlRollbackErrMsg}); tokens.json rollback failed (${tokensRollbackErrMsg}). Hermes daemon is likely in an inconsistent state. Manually inspect ${yamlResult.configPath} and ~/.remnic/tokens.json, then reinstall.`;
|
|
939
|
+
}
|
|
940
|
+
return {
|
|
941
|
+
connectorId: options.connectorId,
|
|
942
|
+
status: "error",
|
|
943
|
+
message
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
try {
|
|
947
|
+
writeSecretFileSync(configPath, JSON.stringify(resolvedConfig, null, 2));
|
|
948
|
+
} catch (writeErr) {
|
|
949
|
+
let tokenRollbackFailed = false;
|
|
950
|
+
let tokenRollbackMsg = "token store restored to pre-install snapshot";
|
|
951
|
+
try {
|
|
952
|
+
saveTokenStore(priorTokenStore);
|
|
953
|
+
} catch (tokenRestoreErr) {
|
|
954
|
+
tokenRollbackFailed = true;
|
|
955
|
+
tokenRollbackMsg = `token rollback failed: ${tokenRestoreErr instanceof Error ? tokenRestoreErr.message : String(tokenRestoreErr)}`;
|
|
956
|
+
}
|
|
957
|
+
let yamlRollbackMsg = "config.yaml restored";
|
|
958
|
+
try {
|
|
959
|
+
if (yamlResult.priorContent === null) {
|
|
960
|
+
let unlinkSucceeded = false;
|
|
961
|
+
let unlinkErr;
|
|
962
|
+
try {
|
|
963
|
+
fs2.unlinkSync(yamlResult.configPath);
|
|
964
|
+
unlinkSucceeded = true;
|
|
965
|
+
} catch (err) {
|
|
966
|
+
unlinkErr = err;
|
|
967
|
+
}
|
|
968
|
+
if (unlinkSucceeded) {
|
|
969
|
+
yamlRollbackMsg = "config.yaml removed (was newly created)";
|
|
970
|
+
} else {
|
|
971
|
+
const unlinkMsg = unlinkErr instanceof Error ? unlinkErr.message : String(unlinkErr);
|
|
972
|
+
yamlRollbackMsg = `config.yaml rollback failed: could not remove newly-created file \u2014 ${unlinkMsg}`;
|
|
973
|
+
}
|
|
974
|
+
} else if (typeof yamlResult.priorContent === "string") {
|
|
975
|
+
writeSecretFileSync(yamlResult.configPath, yamlResult.priorContent);
|
|
976
|
+
yamlRollbackMsg = "config.yaml restored to prior content";
|
|
977
|
+
}
|
|
978
|
+
} catch (yamlRollbackErr) {
|
|
979
|
+
yamlRollbackMsg = `config.yaml rollback failed: ${yamlRollbackErr instanceof Error ? yamlRollbackErr.message : String(yamlRollbackErr)}`;
|
|
980
|
+
}
|
|
981
|
+
const urgentSuffix = tokenRollbackFailed ? ` tokens.json may be in an inconsistent state \u2014 manually restore hermes token with 'remnic token generate hermes'.` : "";
|
|
982
|
+
return {
|
|
983
|
+
connectorId: options.connectorId,
|
|
984
|
+
status: "error",
|
|
985
|
+
message: `Hermes install aborted: connector config write failed \u2014 connector directory may not be writable. Rollback: ${tokenRollbackMsg}; ${yamlRollbackMsg}.${urgentSuffix} Resolve the permission issue, then reinstall.`
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
const notes = [];
|
|
989
|
+
notes.push(`Updated Hermes config: ${yamlResult.configPath}`);
|
|
990
|
+
if (hermesProfile === "default") {
|
|
991
|
+
const legacyDefaultConfigPath = hermesDefaultProfileConfigPath();
|
|
992
|
+
if (!sameHermesConfigTarget(yamlResult.configPath, legacyDefaultConfigPath)) {
|
|
993
|
+
try {
|
|
994
|
+
const legacyDefaultCleanResult = removeHermesConfigFile(legacyDefaultConfigPath);
|
|
995
|
+
if (legacyDefaultCleanResult.updated) {
|
|
996
|
+
notes.push(`Cleaned stale remnic: block from legacy default profile: ${legacyDefaultConfigPath}`);
|
|
997
|
+
}
|
|
998
|
+
} catch {
|
|
999
|
+
notes.push("Note: could not clean stale remnic: block from legacy default profile");
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
let oldProfileResolvesToDifferentFile = false;
|
|
1004
|
+
if (hermesSavedProfile !== void 0) {
|
|
1005
|
+
try {
|
|
1006
|
+
oldProfileResolvesToDifferentFile = !sameHermesConfigTarget(hermesConfigPath(hermesSavedProfile), hermesConfigPath(hermesProfile));
|
|
1007
|
+
} catch {
|
|
1008
|
+
oldProfileResolvesToDifferentFile = false;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
if (oldProfileResolvesToDifferentFile) {
|
|
1012
|
+
try {
|
|
1013
|
+
const oldCleanResult = removeHermesConfig({ profile: hermesSavedProfile });
|
|
1014
|
+
if (oldCleanResult.updated) {
|
|
1015
|
+
notes.push(`Cleaned stale remnic: block from previous profile: ${oldCleanResult.configPath}`);
|
|
1016
|
+
}
|
|
1017
|
+
} catch {
|
|
1018
|
+
notes.push(`Note: could not clean stale remnic: block from previous profile "${hermesSavedProfile}"`);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
if (committed && tokenEntry) {
|
|
1022
|
+
const daemonOk = checkDaemonHealth(hermesHost, hermesPort, tokenEntry.token);
|
|
1023
|
+
if (daemonOk) {
|
|
1024
|
+
notes.push("Daemon health check: OK");
|
|
1025
|
+
} else {
|
|
1026
|
+
notes.push(
|
|
1027
|
+
`Daemon not reachable at ${hermesHost}:${hermesPort} \u2014 start with: remnic daemon start`
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
const suffix = notes.length > 0 ? `
|
|
1032
|
+
${notes.join("\n ")}` : "";
|
|
1033
|
+
return {
|
|
1034
|
+
connectorId: options.connectorId,
|
|
1035
|
+
status: "installed",
|
|
1036
|
+
configPath,
|
|
1037
|
+
message: `Installed ${manifest.name} v${manifest.version}${suffix}`
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
let extensionMessage = "";
|
|
1041
|
+
let extensionInstalled = false;
|
|
1042
|
+
let extensionHandle = null;
|
|
1043
|
+
if (options.connectorId === "codex-cli") {
|
|
1044
|
+
const coerced = coerceInstallExtension(resolvedConfig.installExtension);
|
|
1045
|
+
if (coerced !== void 0) {
|
|
1046
|
+
resolvedConfig.installExtension = coerced;
|
|
1047
|
+
}
|
|
1048
|
+
const shouldInstall = resolvedConfig.installExtension !== false;
|
|
1049
|
+
resolvedConfig.installExtension = shouldInstall;
|
|
1050
|
+
const codexHomeOverride = typeof resolvedConfig.codexHome === "string" && resolvedConfig.codexHome.length > 0 ? resolvedConfig.codexHome : null;
|
|
1051
|
+
const resolvedCodexHome = resolveCodexHome(codexHomeOverride);
|
|
1052
|
+
resolvedConfig.codexHome = resolvedCodexHome;
|
|
1053
|
+
if (shouldInstall) {
|
|
1054
|
+
try {
|
|
1055
|
+
const extensionSourceOverride = typeof resolvedConfig.extensionSourceDir === "string" && resolvedConfig.extensionSourceDir.length > 0 ? resolvedConfig.extensionSourceDir : null;
|
|
1056
|
+
const extResult = installCodexMemoryExtension({
|
|
1057
|
+
codexHome: resolvedCodexHome,
|
|
1058
|
+
sourceDir: extensionSourceOverride
|
|
1059
|
+
});
|
|
1060
|
+
extensionMessage = ` (memory extension: ${extResult.remnicExtensionDir})`;
|
|
1061
|
+
extensionInstalled = true;
|
|
1062
|
+
extensionHandle = extResult;
|
|
1063
|
+
} catch (err) {
|
|
1064
|
+
const errMsg = err instanceof Error ? err.message : "unknown error";
|
|
1065
|
+
let extensionErrTokenRolledBack = false;
|
|
1066
|
+
let extensionErrTokenRollbackMsg = "";
|
|
1067
|
+
if (tokenEntry !== null && nonHermesPriorTokenStore !== null) {
|
|
1068
|
+
try {
|
|
1069
|
+
saveTokenStore(nonHermesPriorTokenStore);
|
|
1070
|
+
extensionErrTokenRolledBack = true;
|
|
1071
|
+
} catch (tokenRestoreErr) {
|
|
1072
|
+
extensionErrTokenRolledBack = false;
|
|
1073
|
+
extensionErrTokenRollbackMsg = tokenRestoreErr instanceof Error ? tokenRestoreErr.message : String(tokenRestoreErr);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
const tokenRollbackSuffix = manifest.requiresToken ? extensionErrTokenRolledBack ? " Token has been rolled back." : ` Token rollback FAILED (${extensionErrTokenRollbackMsg}) \u2014 tokens.json may contain an orphaned entry. Manually inspect ~/.remnic/tokens.json and reinstall.` : "";
|
|
1077
|
+
return {
|
|
1078
|
+
connectorId: options.connectorId,
|
|
1079
|
+
status: "error",
|
|
1080
|
+
message: `Memory extension install failed \u2014 ${errMsg}.${tokenRollbackSuffix} Resolve the issue, then reinstall.`
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
} else {
|
|
1084
|
+
extensionMessage = " (memory extension: skipped via installExtension=false)";
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
let weCloneProxyHandleRollback = null;
|
|
1088
|
+
if (options.connectorId === "weclone") {
|
|
1089
|
+
try {
|
|
1090
|
+
let proxyConfigPath = null;
|
|
1091
|
+
if (existing && fs2.existsSync(configPath)) {
|
|
1092
|
+
try {
|
|
1093
|
+
const savedRegistryConfig = JSON.parse(fs2.readFileSync(configPath, "utf8"));
|
|
1094
|
+
if (typeof savedRegistryConfig.proxyConfigPath === "string" && savedRegistryConfig.proxyConfigPath.length > 0) {
|
|
1095
|
+
proxyConfigPath = savedRegistryConfig.proxyConfigPath;
|
|
1096
|
+
}
|
|
1097
|
+
} catch {
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
if (proxyConfigPath === null) {
|
|
1101
|
+
proxyConfigPath = resolveWeCloneProxyConfigPath();
|
|
1102
|
+
}
|
|
1103
|
+
const prior = readWeCloneProxyConfigIfExists(proxyConfigPath);
|
|
1104
|
+
const proxyConfig = buildWeCloneProxyConfig({
|
|
1105
|
+
userConfig: safeUserConfig,
|
|
1106
|
+
priorConfig: prior ? safeParseJson(prior) : null,
|
|
1107
|
+
authToken: tokenEntry?.token
|
|
1108
|
+
});
|
|
1109
|
+
fs2.mkdirSync(path2.dirname(proxyConfigPath), { recursive: true });
|
|
1110
|
+
weCloneProxyHandleRollback = () => {
|
|
1111
|
+
try {
|
|
1112
|
+
if (prior === null) {
|
|
1113
|
+
if (fs2.existsSync(proxyConfigPath)) {
|
|
1114
|
+
fs2.unlinkSync(proxyConfigPath);
|
|
1115
|
+
}
|
|
1116
|
+
} else {
|
|
1117
|
+
writeSecretFileSync(proxyConfigPath, prior);
|
|
1118
|
+
}
|
|
1119
|
+
} catch {
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
try {
|
|
1123
|
+
writeSecretFileSync(
|
|
1124
|
+
proxyConfigPath,
|
|
1125
|
+
JSON.stringify(proxyConfig, null, 2)
|
|
1126
|
+
);
|
|
1127
|
+
} catch (writeErr) {
|
|
1128
|
+
try {
|
|
1129
|
+
weCloneProxyHandleRollback();
|
|
1130
|
+
} catch {
|
|
1131
|
+
}
|
|
1132
|
+
weCloneProxyHandleRollback = null;
|
|
1133
|
+
throw writeErr;
|
|
1134
|
+
}
|
|
1135
|
+
resolvedConfig.proxyConfigPath = proxyConfigPath;
|
|
1136
|
+
resolvedConfig.proxyPort = proxyConfig.proxyPort;
|
|
1137
|
+
resolvedConfig.wecloneApiUrl = proxyConfig.wecloneApiUrl;
|
|
1138
|
+
resolvedConfig.remnicDaemonUrl = proxyConfig.remnicDaemonUrl;
|
|
1139
|
+
resolvedConfig.sessionStrategy = proxyConfig.sessionStrategy;
|
|
1140
|
+
} catch (weCloneErr) {
|
|
1141
|
+
let tokenRolledBack = false;
|
|
1142
|
+
let tokenRollbackMsg = "";
|
|
1143
|
+
if (tokenEntry !== null && nonHermesPriorTokenStore !== null) {
|
|
1144
|
+
try {
|
|
1145
|
+
saveTokenStore(nonHermesPriorTokenStore);
|
|
1146
|
+
tokenRolledBack = true;
|
|
1147
|
+
} catch (tokenRestoreErr) {
|
|
1148
|
+
tokenRolledBack = false;
|
|
1149
|
+
tokenRollbackMsg = tokenRestoreErr instanceof Error ? tokenRestoreErr.message : String(tokenRestoreErr);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
const tokenSuffix = manifest.requiresToken && tokenEntry !== null ? tokenRolledBack ? " Token has been rolled back." : ` Token rollback FAILED (${tokenRollbackMsg}) \u2014 tokens.json may contain an orphaned entry. Manually inspect ~/.remnic/tokens.json and reinstall.` : "";
|
|
1153
|
+
return {
|
|
1154
|
+
connectorId: options.connectorId,
|
|
1155
|
+
status: "error",
|
|
1156
|
+
message: `WeClone install aborted: proxy config write failed \u2014 ${weCloneErr instanceof Error ? weCloneErr.message : String(weCloneErr)}.${tokenSuffix} Resolve the write permission issue on ~/.remnic/connectors/, then reinstall.`
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
const INTERNAL_KEYS_DENYLIST = [
|
|
1161
|
+
"extensionSourceDir"
|
|
1162
|
+
// test-only override for the plugin-codex source path
|
|
1163
|
+
];
|
|
1164
|
+
for (const key of INTERNAL_KEYS_DENYLIST) {
|
|
1165
|
+
delete resolvedConfig[key];
|
|
1166
|
+
}
|
|
1167
|
+
try {
|
|
1168
|
+
writeSecretFileSync(configPath, JSON.stringify(resolvedConfig, null, 2));
|
|
1169
|
+
} catch (writeErr) {
|
|
1170
|
+
let configWriteTokenRolledBack = false;
|
|
1171
|
+
let configWriteTokenRollbackMsg = "";
|
|
1172
|
+
if (tokenEntry !== null && nonHermesPriorTokenStore !== null) {
|
|
1173
|
+
try {
|
|
1174
|
+
saveTokenStore(nonHermesPriorTokenStore);
|
|
1175
|
+
configWriteTokenRolledBack = true;
|
|
1176
|
+
} catch (tokenRestoreErr) {
|
|
1177
|
+
configWriteTokenRolledBack = false;
|
|
1178
|
+
configWriteTokenRollbackMsg = tokenRestoreErr instanceof Error ? tokenRestoreErr.message : String(tokenRestoreErr);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
if (extensionInstalled && extensionHandle !== null) {
|
|
1182
|
+
try {
|
|
1183
|
+
extensionHandle.rollback();
|
|
1184
|
+
} catch {
|
|
1185
|
+
console.warn(
|
|
1186
|
+
"[remnic/connectors] installConnector: config write failed and extension rollback also failed \u2014 manual cleanup of memories_extensions/remnic may be required."
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
if (weCloneProxyHandleRollback !== null) {
|
|
1191
|
+
try {
|
|
1192
|
+
weCloneProxyHandleRollback();
|
|
1193
|
+
} catch {
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
const configWriteTokenSuffix = manifest.requiresToken && tokenEntry !== null ? configWriteTokenRolledBack ? " Token has been rolled back." : ` Token rollback FAILED (${configWriteTokenRollbackMsg}) \u2014 tokens.json may contain an orphaned entry. Manually inspect ~/.remnic/tokens.json and reinstall.` : "";
|
|
1197
|
+
return {
|
|
1198
|
+
connectorId: options.connectorId,
|
|
1199
|
+
status: "error",
|
|
1200
|
+
message: `${manifest.name} install aborted: connector config write failed \u2014 ${writeErr instanceof Error ? writeErr.message : String(writeErr)}.${configWriteTokenSuffix} Resolve the write permission issue, then reinstall.`
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
if (extensionInstalled && extensionHandle !== null) {
|
|
1204
|
+
extensionHandle.commit();
|
|
1205
|
+
}
|
|
1206
|
+
return {
|
|
1207
|
+
connectorId: options.connectorId,
|
|
1208
|
+
status: "installed",
|
|
1209
|
+
configPath,
|
|
1210
|
+
message: `Installed ${manifest.name} v${manifest.version}${extensionMessage}`
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
function removeConnector(connectorId) {
|
|
1214
|
+
const configDir = getConnectorsDir();
|
|
1215
|
+
const configPath = path2.join(configDir, `${connectorId}.json`);
|
|
1216
|
+
let codexHomeOverride = null;
|
|
1217
|
+
let savedInstallExtension = void 0;
|
|
1218
|
+
let configParsed = false;
|
|
1219
|
+
if (connectorId === "codex-cli" && fs2.existsSync(configPath)) {
|
|
1220
|
+
try {
|
|
1221
|
+
const parsed = JSON.parse(fs2.readFileSync(configPath, "utf8"));
|
|
1222
|
+
configParsed = true;
|
|
1223
|
+
if (typeof parsed.codexHome === "string" && parsed.codexHome.length > 0) {
|
|
1224
|
+
codexHomeOverride = parsed.codexHome;
|
|
1225
|
+
}
|
|
1226
|
+
const coerced = coerceInstallExtension(parsed.installExtension);
|
|
1227
|
+
if (coerced !== void 0) {
|
|
1228
|
+
savedInstallExtension = coerced;
|
|
1229
|
+
}
|
|
1230
|
+
} catch {
|
|
1231
|
+
console.debug(
|
|
1232
|
+
"[remnic/connectors] removeConnector: codex-cli.json parse failed \u2014 skipping extension removal to avoid touching unverified paths"
|
|
1233
|
+
);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
if (!fs2.existsSync(configPath)) {
|
|
1237
|
+
let staleTokenRevoked = false;
|
|
1238
|
+
try {
|
|
1239
|
+
staleTokenRevoked = revokeToken(connectorId);
|
|
1240
|
+
} catch {
|
|
1241
|
+
}
|
|
1242
|
+
const message = staleTokenRevoked ? `${connectorId} is not installed. Removed stale token entry for ${connectorId}.` : "Not installed";
|
|
1243
|
+
return {
|
|
1244
|
+
connectorId,
|
|
1245
|
+
configPath,
|
|
1246
|
+
status: "not_found",
|
|
1247
|
+
message
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
let storedProfile = "default";
|
|
1251
|
+
if (connectorId === "hermes") {
|
|
1252
|
+
try {
|
|
1253
|
+
const stored = JSON.parse(fs2.readFileSync(configPath, "utf8"));
|
|
1254
|
+
if (typeof stored?.profile === "string") storedProfile = stored.profile;
|
|
1255
|
+
} catch {
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
let weCloneProxyConfigPath = null;
|
|
1259
|
+
let weCloneRegistryParseFailed = false;
|
|
1260
|
+
if (connectorId === "weclone") {
|
|
1261
|
+
try {
|
|
1262
|
+
const stored = JSON.parse(fs2.readFileSync(configPath, "utf8"));
|
|
1263
|
+
if (typeof stored.proxyConfigPath === "string" && stored.proxyConfigPath.length > 0) {
|
|
1264
|
+
weCloneProxyConfigPath = stored.proxyConfigPath;
|
|
1265
|
+
}
|
|
1266
|
+
} catch {
|
|
1267
|
+
weCloneRegistryParseFailed = true;
|
|
1268
|
+
}
|
|
1269
|
+
if (weCloneProxyConfigPath === null && !weCloneRegistryParseFailed) {
|
|
1270
|
+
try {
|
|
1271
|
+
weCloneProxyConfigPath = resolveWeCloneProxyConfigPath();
|
|
1272
|
+
} catch {
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
if (connectorId === "weclone" && weCloneRegistryParseFailed) {
|
|
1277
|
+
console.warn(
|
|
1278
|
+
"[remnic/connectors] removeConnector: weclone.json is malformed \u2014 aborting removal to preserve provenance. Fix or delete " + configPath + " manually and retry."
|
|
1279
|
+
);
|
|
1280
|
+
return {
|
|
1281
|
+
connectorId,
|
|
1282
|
+
configPath,
|
|
1283
|
+
message: "Removal aborted: weclone.json is malformed. Registry config left in place for inspection; proxy config NOT removed.",
|
|
1284
|
+
status: "skipped",
|
|
1285
|
+
reason: "config-parse-failed"
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
if (connectorId === "codex-cli" && fs2.existsSync(configPath) && !configParsed) {
|
|
1289
|
+
console.warn(
|
|
1290
|
+
"[remnic/connectors] removeConnector: codex-cli.json is malformed \u2014 aborting removal to preserve provenance. Fix or delete " + configPath + " manually and retry."
|
|
1291
|
+
);
|
|
1292
|
+
return {
|
|
1293
|
+
connectorId,
|
|
1294
|
+
configPath,
|
|
1295
|
+
message: "Removal aborted: codex-cli.json is malformed. Config file left in place for inspection.",
|
|
1296
|
+
status: "skipped",
|
|
1297
|
+
reason: "config-parse-failed"
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
let extensionMessage = "";
|
|
1301
|
+
if (connectorId === "codex-cli") {
|
|
1302
|
+
if (savedInstallExtension === false) {
|
|
1303
|
+
extensionMessage = " (memory extension: skipped \u2014 installExtension=false)";
|
|
1304
|
+
} else if (savedInstallExtension !== true || codexHomeOverride === null) {
|
|
1305
|
+
extensionMessage = " (memory extension: skipped \u2014 no install provenance in saved config)";
|
|
1306
|
+
} else {
|
|
1307
|
+
const extResult = removeCodexMemoryExtension({ codexHome: codexHomeOverride });
|
|
1308
|
+
extensionMessage = extResult.removed ? ` (memory extension removed: ${extResult.remnicExtensionDir})` : " (no memory extension present)";
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
try {
|
|
1312
|
+
fs2.unlinkSync(configPath);
|
|
1313
|
+
} catch (unlinkErr) {
|
|
1314
|
+
const sanitizedErr = unlinkErr instanceof Error ? unlinkErr.message : String(unlinkErr);
|
|
1315
|
+
return {
|
|
1316
|
+
connectorId,
|
|
1317
|
+
configPath,
|
|
1318
|
+
status: "error",
|
|
1319
|
+
message: `${connectorId} remove aborted: could not delete connector file (${sanitizedErr}). Token and any connector-specific state were not modified.`
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
const notes = [];
|
|
1323
|
+
let tokenRevoked = true;
|
|
1324
|
+
try {
|
|
1325
|
+
revokeToken(connectorId);
|
|
1326
|
+
} catch (revokeErr) {
|
|
1327
|
+
tokenRevoked = false;
|
|
1328
|
+
const revokeMsg = revokeErr instanceof Error ? revokeErr.message : String(revokeErr);
|
|
1329
|
+
notes.push(`Warning: token revocation failed \u2014 ${revokeMsg}. The token for ${connectorId} may still be present in tokens.json.`);
|
|
1330
|
+
}
|
|
1331
|
+
let weCloneProxyDeleteFailed = null;
|
|
1332
|
+
if (connectorId === "weclone") {
|
|
1333
|
+
if (weCloneProxyConfigPath === null) {
|
|
1334
|
+
notes.push(
|
|
1335
|
+
"WeClone proxy config cleanup skipped: no persisted path found in saved config (likely a legacy install predating proxyConfigPath provenance)."
|
|
1336
|
+
);
|
|
1337
|
+
} else {
|
|
1338
|
+
const expectedSuffix = path2.join("connectors", "weclone.json");
|
|
1339
|
+
const isSafePath = path2.isAbsolute(weCloneProxyConfigPath) && weCloneProxyConfigPath.endsWith(expectedSuffix);
|
|
1340
|
+
if (!isSafePath) {
|
|
1341
|
+
weCloneProxyDeleteFailed = `Proxy config path ${JSON.stringify(weCloneProxyConfigPath)} failed safety validation (must be absolute and end with "${expectedSuffix}"). Refusing to delete \u2014 remove the file manually if it exists.`;
|
|
1342
|
+
} else {
|
|
1343
|
+
try {
|
|
1344
|
+
if (fs2.existsSync(weCloneProxyConfigPath)) {
|
|
1345
|
+
fs2.unlinkSync(weCloneProxyConfigPath);
|
|
1346
|
+
notes.push(`Removed WeClone proxy config: ${weCloneProxyConfigPath}`);
|
|
1347
|
+
}
|
|
1348
|
+
} catch (err) {
|
|
1349
|
+
weCloneProxyDeleteFailed = err instanceof Error ? err.message : String(err);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
if (weCloneProxyDeleteFailed !== null && weCloneProxyConfigPath !== null) {
|
|
1355
|
+
const tokenStatus = tokenRevoked ? "the registry config was deleted and the token was revoked" : "the registry config was deleted but TOKEN REVOCATION ALSO FAILED \u2014 inspect ~/.remnic/tokens.json and revoke manually";
|
|
1356
|
+
return {
|
|
1357
|
+
connectorId,
|
|
1358
|
+
configPath,
|
|
1359
|
+
status: "error",
|
|
1360
|
+
message: `WeClone remove partially succeeded: ${tokenStatus}, but the proxy config at ${weCloneProxyConfigPath} could not be deleted (${weCloneProxyDeleteFailed}). Manually remove that file \u2014 it may still contain a Remnic daemon bearer token.`
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
if (connectorId === "hermes") {
|
|
1364
|
+
try {
|
|
1365
|
+
const yamlResult = removeHermesConfig({ profile: storedProfile });
|
|
1366
|
+
if (yamlResult.updated) {
|
|
1367
|
+
notes.push(`Removed remnic: block from Hermes config: ${yamlResult.configPath}`);
|
|
1368
|
+
} else if (yamlResult.reason?.startsWith("Hermes config cleanup partially failed:")) {
|
|
1369
|
+
const tokenStatus = tokenRevoked ? "the connector registry config was deleted and the token was revoked" : "the connector registry config was deleted but TOKEN REVOCATION ALSO FAILED \u2014 inspect ~/.remnic/tokens.json and revoke manually";
|
|
1370
|
+
return {
|
|
1371
|
+
connectorId,
|
|
1372
|
+
configPath,
|
|
1373
|
+
status: "error",
|
|
1374
|
+
message: `Hermes remove partially succeeded: ${tokenStatus}, but ${yamlResult.reason}. Updated paths: ${yamlResult.configPath}. Manually remove any stale remnic: block and token material from the failed Hermes config path.`
|
|
1375
|
+
};
|
|
1376
|
+
} else if (yamlResult.skipped) {
|
|
1377
|
+
notes.push(`Hermes config cleanup skipped: ${yamlResult.reason}`);
|
|
1378
|
+
}
|
|
1379
|
+
} catch (err) {
|
|
1380
|
+
notes.push(
|
|
1381
|
+
`Hermes config cleanup skipped: ${err instanceof Error ? err.message : String(err)}`
|
|
1382
|
+
);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
const suffix = notes.length > 0 ? `
|
|
1386
|
+
${notes.join("\n ")}` : "";
|
|
1387
|
+
return {
|
|
1388
|
+
connectorId,
|
|
1389
|
+
configPath,
|
|
1390
|
+
status: "removed",
|
|
1391
|
+
message: `Removed${extensionMessage}${suffix}`
|
|
1392
|
+
};
|
|
1393
|
+
}
|
|
1394
|
+
function sanitizeHermesProfile(profile) {
|
|
1395
|
+
if (typeof profile !== "string" || profile.length === 0) {
|
|
1396
|
+
throw new Error("Hermes profile name must be a non-empty string");
|
|
1397
|
+
}
|
|
1398
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(profile)) {
|
|
1399
|
+
throw new Error(
|
|
1400
|
+
`Invalid Hermes profile name: ${JSON.stringify(profile)} \u2014 must match [A-Za-z0-9][A-Za-z0-9._-]*`
|
|
1401
|
+
);
|
|
1402
|
+
}
|
|
1403
|
+
if (profile.includes("..")) {
|
|
1404
|
+
throw new Error(`Invalid Hermes profile name: ${JSON.stringify(profile)} \u2014 must not contain ".."`);
|
|
1405
|
+
}
|
|
1406
|
+
return profile;
|
|
1407
|
+
}
|
|
1408
|
+
function hermesConfigPath(profile) {
|
|
1409
|
+
const safeProfile = sanitizeHermesProfile(profile);
|
|
1410
|
+
const hermesRoot = path2.resolve(resolveHomeDir(), ".hermes");
|
|
1411
|
+
const rootConfigPath = path2.join(hermesRoot, "config.yaml");
|
|
1412
|
+
const profilesRoot = path2.join(hermesRoot, "profiles");
|
|
1413
|
+
if (safeProfile === "default") {
|
|
1414
|
+
const defaultProfileDir = path2.join(profilesRoot, safeProfile);
|
|
1415
|
+
if (isFile(rootConfigPath) || !fs2.existsSync(rootConfigPath) && !isDirectory(defaultProfileDir)) {
|
|
1416
|
+
return rootConfigPath;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
const cfgPath = path2.resolve(profilesRoot, safeProfile, "config.yaml");
|
|
1420
|
+
const rel = path2.relative(profilesRoot, cfgPath);
|
|
1421
|
+
if (rel.startsWith("..") || path2.isAbsolute(rel)) {
|
|
1422
|
+
throw new Error(
|
|
1423
|
+
`Invalid Hermes profile path: resolved outside ${profilesRoot}`
|
|
1424
|
+
);
|
|
1425
|
+
}
|
|
1426
|
+
return cfgPath;
|
|
1427
|
+
}
|
|
1428
|
+
function isDirectory(filePath) {
|
|
1429
|
+
try {
|
|
1430
|
+
return fs2.statSync(filePath).isDirectory();
|
|
1431
|
+
} catch {
|
|
1432
|
+
return false;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
function isFile(filePath) {
|
|
1436
|
+
try {
|
|
1437
|
+
return fs2.statSync(filePath).isFile();
|
|
1438
|
+
} catch {
|
|
1439
|
+
return false;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
function hermesConfigTarget(filePath) {
|
|
1443
|
+
try {
|
|
1444
|
+
return fs2.realpathSync.native(filePath);
|
|
1445
|
+
} catch {
|
|
1446
|
+
return path2.resolve(filePath);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
function sameHermesConfigTarget(leftPath, rightPath) {
|
|
1450
|
+
return hermesConfigTarget(leftPath) === hermesConfigTarget(rightPath);
|
|
1451
|
+
}
|
|
1452
|
+
function hermesDefaultProfileConfigPath() {
|
|
1453
|
+
const hermesRoot = path2.resolve(resolveHomeDir(), ".hermes");
|
|
1454
|
+
return path2.join(hermesRoot, "profiles", "default", "config.yaml");
|
|
1455
|
+
}
|
|
1456
|
+
function hermesConfigCleanupPaths(profile) {
|
|
1457
|
+
const cfgPath = hermesConfigPath(profile);
|
|
1458
|
+
const safeProfile = sanitizeHermesProfile(profile);
|
|
1459
|
+
if (safeProfile !== "default") {
|
|
1460
|
+
return [cfgPath];
|
|
1461
|
+
}
|
|
1462
|
+
return [.../* @__PURE__ */ new Set([cfgPath, hermesDefaultProfileConfigPath()])];
|
|
1463
|
+
}
|
|
1464
|
+
function sanitizeHermesHost(host) {
|
|
1465
|
+
if (typeof host !== "string" || host.length === 0) {
|
|
1466
|
+
throw new Error("Hermes host must be a non-empty string");
|
|
1467
|
+
}
|
|
1468
|
+
if (host.length > 253) {
|
|
1469
|
+
throw new Error(`Hermes host too long (max 253 chars): ${JSON.stringify(host.slice(0, 32))}\u2026`);
|
|
1470
|
+
}
|
|
1471
|
+
if (host.startsWith("[")) {
|
|
1472
|
+
if (!host.endsWith("]")) {
|
|
1473
|
+
throw new Error(
|
|
1474
|
+
`Invalid Hermes host: ${JSON.stringify(host)} \u2014 unbalanced brackets in IPv6 literal`
|
|
1475
|
+
);
|
|
1476
|
+
}
|
|
1477
|
+
const inner = host.slice(1, -1);
|
|
1478
|
+
if (inner.length === 0 || !/^[0-9A-Fa-f:]+$/.test(inner)) {
|
|
1479
|
+
throw new Error(
|
|
1480
|
+
`Invalid Hermes host: ${JSON.stringify(host)} \u2014 bracketed IPv6 literal must contain only hex digits and colons`
|
|
1481
|
+
);
|
|
1482
|
+
}
|
|
1483
|
+
return host;
|
|
1484
|
+
}
|
|
1485
|
+
if (host.includes(":")) {
|
|
1486
|
+
throw new Error(
|
|
1487
|
+
`Invalid Hermes host: ${JSON.stringify(host)} \u2014 host must not include a port; supply the port separately with --config port=<n>`
|
|
1488
|
+
);
|
|
1489
|
+
}
|
|
1490
|
+
if (!/^[A-Za-z0-9._\-]+$/.test(host)) {
|
|
1491
|
+
throw new Error(
|
|
1492
|
+
`Invalid Hermes host: ${JSON.stringify(host)} \u2014 must be a plain hostname or IP literal`
|
|
1493
|
+
);
|
|
1494
|
+
}
|
|
1495
|
+
return host;
|
|
1496
|
+
}
|
|
1497
|
+
function sanitizeHermesPort(port) {
|
|
1498
|
+
const numeric = Number(port);
|
|
1499
|
+
if (!Number.isInteger(numeric)) {
|
|
1500
|
+
throw new Error(
|
|
1501
|
+
`Invalid Hermes port "${port}": must be a positive integer`
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
if (numeric < 1 || numeric > 65535) {
|
|
1505
|
+
throw new Error(`Invalid Hermes port: ${JSON.stringify(port)} \u2014 must be an integer in [1, 65535]`);
|
|
1506
|
+
}
|
|
1507
|
+
return numeric;
|
|
1508
|
+
}
|
|
1509
|
+
function writeSecretFileSync(filePath, data) {
|
|
1510
|
+
fs2.writeFileSync(filePath, data, { mode: 384 });
|
|
1511
|
+
try {
|
|
1512
|
+
fs2.chmodSync(filePath, 384);
|
|
1513
|
+
} catch {
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
function upsertHermesConfig(opts) {
|
|
1517
|
+
const cfgPath = hermesConfigPath(opts.profile);
|
|
1518
|
+
const profileDir = path2.dirname(cfgPath);
|
|
1519
|
+
const safeHost = sanitizeHermesHost(opts.host);
|
|
1520
|
+
const safePort = sanitizeHermesPort(opts.port);
|
|
1521
|
+
if (!/^[A-Za-z0-9_]+$/.test(opts.token)) {
|
|
1522
|
+
throw new Error("Invalid Hermes token: contains non-alphanumeric characters");
|
|
1523
|
+
}
|
|
1524
|
+
if (!isDirectory(profileDir)) {
|
|
1525
|
+
return {
|
|
1526
|
+
updated: false,
|
|
1527
|
+
skipped: true,
|
|
1528
|
+
reason: `Hermes profile directory not found: ${profileDir}`,
|
|
1529
|
+
configPath: cfgPath
|
|
1530
|
+
};
|
|
1531
|
+
}
|
|
1532
|
+
const block = [
|
|
1533
|
+
"remnic:",
|
|
1534
|
+
` host: "${safeHost}"`,
|
|
1535
|
+
` port: ${safePort}`,
|
|
1536
|
+
` token: "${opts.token}"`
|
|
1537
|
+
].join("\n");
|
|
1538
|
+
if (!fs2.existsSync(cfgPath)) {
|
|
1539
|
+
writeSecretFileSync(cfgPath, block + "\n");
|
|
1540
|
+
return { updated: true, skipped: false, configPath: cfgPath, priorContent: null };
|
|
1541
|
+
}
|
|
1542
|
+
const raw = fs2.readFileSync(cfgPath, "utf8");
|
|
1543
|
+
const hasRemnicBlock = /^remnic:/m.test(raw);
|
|
1544
|
+
if (!hasRemnicBlock) {
|
|
1545
|
+
const separator = raw.endsWith("\n") ? "\n" : "\n\n";
|
|
1546
|
+
writeSecretFileSync(cfgPath, raw + separator + block + "\n");
|
|
1547
|
+
return { updated: true, skipped: false, configPath: cfgPath, priorContent: raw };
|
|
1548
|
+
}
|
|
1549
|
+
const splitLines = raw.split("\n");
|
|
1550
|
+
if (splitLines.length > 0 && splitLines[splitLines.length - 1] === "") {
|
|
1551
|
+
splitLines.pop();
|
|
1552
|
+
}
|
|
1553
|
+
const lines = splitLines;
|
|
1554
|
+
const newLines = [];
|
|
1555
|
+
let inRemnicBlock = false;
|
|
1556
|
+
let blockWritten = false;
|
|
1557
|
+
const written = { host: false, port: false, token: false };
|
|
1558
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1559
|
+
const line = lines[i];
|
|
1560
|
+
if (/^remnic:/.test(line)) {
|
|
1561
|
+
inRemnicBlock = true;
|
|
1562
|
+
newLines.push(line);
|
|
1563
|
+
continue;
|
|
1564
|
+
}
|
|
1565
|
+
if (inRemnicBlock) {
|
|
1566
|
+
if (line.length > 0 && !/^\s/.test(line)) {
|
|
1567
|
+
if (!written.host) newLines.push(` host: "${safeHost}"`);
|
|
1568
|
+
if (!written.port) newLines.push(` port: ${safePort}`);
|
|
1569
|
+
if (!written.token) newLines.push(` token: "${opts.token}"`);
|
|
1570
|
+
blockWritten = true;
|
|
1571
|
+
inRemnicBlock = false;
|
|
1572
|
+
newLines.push(line);
|
|
1573
|
+
continue;
|
|
1574
|
+
}
|
|
1575
|
+
if (/^\s+host:/.test(line)) {
|
|
1576
|
+
newLines.push(` host: "${safeHost}"`);
|
|
1577
|
+
written.host = true;
|
|
1578
|
+
} else if (/^\s+port:/.test(line)) {
|
|
1579
|
+
newLines.push(` port: ${safePort}`);
|
|
1580
|
+
written.port = true;
|
|
1581
|
+
} else if (/^\s+token:/.test(line)) {
|
|
1582
|
+
newLines.push(` token: "${opts.token}"`);
|
|
1583
|
+
written.token = true;
|
|
1584
|
+
} else {
|
|
1585
|
+
newLines.push(line);
|
|
1586
|
+
}
|
|
1587
|
+
continue;
|
|
1588
|
+
}
|
|
1589
|
+
newLines.push(line);
|
|
1590
|
+
}
|
|
1591
|
+
if (inRemnicBlock && !blockWritten) {
|
|
1592
|
+
if (!written.host) newLines.push(` host: "${safeHost}"`);
|
|
1593
|
+
if (!written.port) newLines.push(` port: ${safePort}`);
|
|
1594
|
+
if (!written.token) newLines.push(` token: "${opts.token}"`);
|
|
1595
|
+
}
|
|
1596
|
+
writeSecretFileSync(cfgPath, newLines.join("\n") + "\n");
|
|
1597
|
+
return { updated: true, skipped: false, configPath: cfgPath, priorContent: raw };
|
|
1598
|
+
}
|
|
1599
|
+
function removeHermesConfig(opts) {
|
|
1600
|
+
const cfgPaths = hermesConfigCleanupPaths(opts.profile);
|
|
1601
|
+
const results = cfgPaths.map((cfgPath) => {
|
|
1602
|
+
try {
|
|
1603
|
+
return removeHermesConfigFile(cfgPath);
|
|
1604
|
+
} catch (err) {
|
|
1605
|
+
return {
|
|
1606
|
+
updated: false,
|
|
1607
|
+
skipped: true,
|
|
1608
|
+
reason: `Hermes config cleanup failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
1609
|
+
configPath: cfgPath
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
const updated = results.filter((result) => result.updated);
|
|
1614
|
+
const cleanupFailures = results.filter((result) => result.reason?.startsWith("Hermes config cleanup failed:"));
|
|
1615
|
+
if (updated.length > 0) {
|
|
1616
|
+
const updatedPaths = updated.map((result) => result.configPath).join(", ");
|
|
1617
|
+
if (cleanupFailures.length > 0) {
|
|
1618
|
+
const failedPaths = cleanupFailures.map((result) => result.configPath).join(", ");
|
|
1619
|
+
return {
|
|
1620
|
+
updated: false,
|
|
1621
|
+
skipped: true,
|
|
1622
|
+
reason: `Hermes config cleanup partially failed: updated ${updatedPaths}; failed ${failedPaths}`,
|
|
1623
|
+
configPath: `${updatedPaths}; failed: ${failedPaths}`
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1626
|
+
return {
|
|
1627
|
+
updated: true,
|
|
1628
|
+
skipped: false,
|
|
1629
|
+
configPath: updatedPaths
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
const cleanupFailure = cleanupFailures[0];
|
|
1633
|
+
if (cleanupFailure) {
|
|
1634
|
+
return cleanupFailure;
|
|
1635
|
+
}
|
|
1636
|
+
const existingWithoutBlock = results.find((result) => result.reason !== "Hermes config.yaml not found");
|
|
1637
|
+
return existingWithoutBlock ?? results[0] ?? {
|
|
1638
|
+
updated: false,
|
|
1639
|
+
skipped: true,
|
|
1640
|
+
reason: "Hermes config.yaml not found",
|
|
1641
|
+
configPath: hermesConfigPath(opts.profile)
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
function removeHermesConfigFile(cfgPath) {
|
|
1645
|
+
if (!fs2.existsSync(cfgPath)) {
|
|
1646
|
+
return {
|
|
1647
|
+
updated: false,
|
|
1648
|
+
skipped: true,
|
|
1649
|
+
reason: "Hermes config.yaml not found",
|
|
1650
|
+
configPath: cfgPath
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
const raw = fs2.readFileSync(cfgPath, "utf8");
|
|
1654
|
+
if (!/^remnic:/m.test(raw)) {
|
|
1655
|
+
return {
|
|
1656
|
+
updated: false,
|
|
1657
|
+
skipped: true,
|
|
1658
|
+
reason: "No remnic: block found in config.yaml",
|
|
1659
|
+
configPath: cfgPath
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
const lines = raw.split("\n");
|
|
1663
|
+
const newLines = [];
|
|
1664
|
+
let inRemnicBlock = false;
|
|
1665
|
+
for (const line of lines) {
|
|
1666
|
+
if (/^remnic:/.test(line)) {
|
|
1667
|
+
inRemnicBlock = true;
|
|
1668
|
+
continue;
|
|
1669
|
+
}
|
|
1670
|
+
if (inRemnicBlock) {
|
|
1671
|
+
if (line.length > 0 && !/^\s/.test(line)) {
|
|
1672
|
+
inRemnicBlock = false;
|
|
1673
|
+
newLines.push(line);
|
|
1674
|
+
}
|
|
1675
|
+
continue;
|
|
1676
|
+
}
|
|
1677
|
+
newLines.push(line);
|
|
1678
|
+
}
|
|
1679
|
+
while (newLines.length > 0 && newLines[newLines.length - 1]?.trim() === "") {
|
|
1680
|
+
newLines.pop();
|
|
1681
|
+
}
|
|
1682
|
+
writeSecretFileSync(cfgPath, newLines.length > 0 ? newLines.join("\n") + "\n" : "");
|
|
1683
|
+
return { updated: true, skipped: false, configPath: cfgPath };
|
|
1684
|
+
}
|
|
1685
|
+
var HEALTH_EXIT_OK = 0;
|
|
1686
|
+
var HEALTH_EXIT_UNAUTHORIZED = 2;
|
|
1687
|
+
function checkDaemonHealth(host, port, authToken) {
|
|
1688
|
+
try {
|
|
1689
|
+
const safePort = Math.trunc(Number(port));
|
|
1690
|
+
if (!Number.isFinite(safePort) || safePort < 1 || safePort > 65535) {
|
|
1691
|
+
return false;
|
|
1692
|
+
}
|
|
1693
|
+
const bareHost = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
|
|
1694
|
+
const script = [
|
|
1695
|
+
"const http = require('http');",
|
|
1696
|
+
"const env = process['env'];",
|
|
1697
|
+
"const headers = {};",
|
|
1698
|
+
"if (env.REMNIC_HEALTH_TOKEN) {",
|
|
1699
|
+
" headers['authorization'] = 'Bearer ' + env.REMNIC_HEALTH_TOKEN;",
|
|
1700
|
+
"}",
|
|
1701
|
+
"const req = http.get({",
|
|
1702
|
+
" host: env.REMNIC_HEALTH_HOST,",
|
|
1703
|
+
" port: parseInt(env.REMNIC_HEALTH_PORT, 10),",
|
|
1704
|
+
" path: '/engram/v1/health',",
|
|
1705
|
+
" headers,",
|
|
1706
|
+
" timeout: 3000,",
|
|
1707
|
+
"}, (res) => { process.exit(res.statusCode === 200 ? 0 : res.statusCode === 401 ? 2 : 1); });",
|
|
1708
|
+
"req.on('error', () => process.exit(1));",
|
|
1709
|
+
"req.on('timeout', () => { req.destroy(); process.exit(1); });"
|
|
1710
|
+
].join("\n");
|
|
1711
|
+
const env = mergeEnv({
|
|
1712
|
+
REMNIC_HEALTH_HOST: bareHost,
|
|
1713
|
+
REMNIC_HEALTH_PORT: String(safePort)
|
|
1714
|
+
});
|
|
1715
|
+
if (authToken) {
|
|
1716
|
+
env.REMNIC_HEALTH_TOKEN = authToken;
|
|
1717
|
+
}
|
|
1718
|
+
const processPath = process.execPath;
|
|
1719
|
+
const launchOptions = { timeout: 4e3, env };
|
|
1720
|
+
const result = launchProcessSync(processPath, ["-e", script], launchOptions);
|
|
1721
|
+
if (result.status === HEALTH_EXIT_OK) {
|
|
1722
|
+
return true;
|
|
1723
|
+
}
|
|
1724
|
+
if (result.status === HEALTH_EXIT_UNAUTHORIZED) {
|
|
1725
|
+
console.error(
|
|
1726
|
+
"[remnic/connectors] health probe got 401 \u2014 retrying after token cache TTL..."
|
|
1727
|
+
);
|
|
1728
|
+
launchProcessSync(processPath, ["-e", "setTimeout(() => {}, 6000)"], {
|
|
1729
|
+
timeout: 7e3,
|
|
1730
|
+
env: {}
|
|
1731
|
+
});
|
|
1732
|
+
const retry = launchProcessSync(processPath, ["-e", script], launchOptions);
|
|
1733
|
+
return retry.status === HEALTH_EXIT_OK;
|
|
1734
|
+
}
|
|
1735
|
+
return false;
|
|
1736
|
+
} catch {
|
|
1737
|
+
return false;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
async function doctorConnector(connectorId) {
|
|
1741
|
+
const installed = listConnectors().installed;
|
|
1742
|
+
const instance = installed.find((c) => c.connectorId === connectorId);
|
|
1743
|
+
if (!instance) {
|
|
1744
|
+
return {
|
|
1745
|
+
connectorId,
|
|
1746
|
+
checks: [{ name: "Installed", ok: false, detail: "Not installed" }],
|
|
1747
|
+
healthy: false
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
const configPath = path2.join(getConnectorsDir(), `${connectorId}.json`);
|
|
1751
|
+
const checks = [];
|
|
1752
|
+
checks.push({
|
|
1753
|
+
name: "Config file",
|
|
1754
|
+
ok: fs2.existsSync(configPath),
|
|
1755
|
+
detail: configPath
|
|
1756
|
+
});
|
|
1757
|
+
try {
|
|
1758
|
+
const raw = fs2.readFileSync(configPath, "utf8");
|
|
1759
|
+
JSON.parse(raw);
|
|
1760
|
+
checks.push({ name: "Config valid", ok: true, detail: "OK" });
|
|
1761
|
+
} catch (e) {
|
|
1762
|
+
checks.push({ name: "Config valid", ok: false, detail: String(e) });
|
|
1763
|
+
}
|
|
1764
|
+
const mcpUrl = instance.config.mcpServerUrl;
|
|
1765
|
+
if (mcpUrl) {
|
|
1766
|
+
try {
|
|
1767
|
+
const controller = new AbortController();
|
|
1768
|
+
const timeoutId = setTimeout(() => controller.abort(), 3e3);
|
|
1769
|
+
const response = await fetch(mcpUrl, { signal: controller.signal });
|
|
1770
|
+
clearTimeout(timeoutId);
|
|
1771
|
+
checks.push({ name: "MCP server", ok: response.ok, detail: mcpUrl });
|
|
1772
|
+
} catch (e) {
|
|
1773
|
+
checks.push({
|
|
1774
|
+
name: "MCP server",
|
|
1775
|
+
ok: false,
|
|
1776
|
+
detail: `Cannot reach ${mcpUrl}: ${e instanceof Error ? e.message : "unknown"}`
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
const memoryDir = instance.config.memoryDir;
|
|
1781
|
+
if (memoryDir) {
|
|
1782
|
+
if (fs2.existsSync(memoryDir)) {
|
|
1783
|
+
checks.push({ name: "Memory directory", ok: true, detail: memoryDir });
|
|
1784
|
+
} else {
|
|
1785
|
+
checks.push({ name: "Memory directory", ok: false, detail: `Not found: ${memoryDir}` });
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
const healthy = checks.every((c) => c.ok);
|
|
1789
|
+
return { connectorId, checks, healthy };
|
|
1790
|
+
}
|
|
1791
|
+
var CODEX_MEMORIES_SUBDIR = "memories";
|
|
1792
|
+
var CODEX_EXTENSIONS_SUBDIR = "memories_extensions";
|
|
1793
|
+
var REMNIC_EXTENSION_DIR_NAME = "remnic";
|
|
1794
|
+
function resolveCodexHome(override) {
|
|
1795
|
+
if (override && typeof override === "string" && override.trim().length > 0) {
|
|
1796
|
+
return path2.resolve(override.trim());
|
|
1797
|
+
}
|
|
1798
|
+
const envHome = readEnvVar("CODEX_HOME");
|
|
1799
|
+
if (envHome && envHome.trim().length > 0) {
|
|
1800
|
+
return path2.resolve(envHome.trim());
|
|
1801
|
+
}
|
|
1802
|
+
const home = readEnvVar("HOME") || readEnvVar("USERPROFILE") || resolveHomeDir();
|
|
1803
|
+
return path2.resolve(home, ".codex");
|
|
1804
|
+
}
|
|
1805
|
+
function resolveCodexMemoryExtensionPaths(codexHomeOverride) {
|
|
1806
|
+
const codexHome = resolveCodexHome(codexHomeOverride);
|
|
1807
|
+
const memoriesDir = path2.join(codexHome, CODEX_MEMORIES_SUBDIR);
|
|
1808
|
+
const extensionsRoot = path2.join(path2.dirname(memoriesDir), CODEX_EXTENSIONS_SUBDIR);
|
|
1809
|
+
const remnicExtensionDir = path2.join(extensionsRoot, REMNIC_EXTENSION_DIR_NAME);
|
|
1810
|
+
return { codexHome, memoriesDir, extensionsRoot, remnicExtensionDir };
|
|
1811
|
+
}
|
|
1812
|
+
function locatePluginCodexExtensionSource(override) {
|
|
1813
|
+
if (override && typeof override === "string" && override.trim().length > 0) {
|
|
1814
|
+
const resolved = path2.resolve(override.trim());
|
|
1815
|
+
if (fs2.existsSync(resolved) && fs2.statSync(resolved).isDirectory()) {
|
|
1816
|
+
return resolved;
|
|
1817
|
+
}
|
|
1818
|
+
throw new Error(`Codex extension source directory not found: ${resolved}`);
|
|
1819
|
+
}
|
|
1820
|
+
const EXTENSION_SUBPATH = path2.join("memories_extensions", "remnic");
|
|
1821
|
+
const WORKSPACE_RELATIVE_PATH = path2.join(
|
|
1822
|
+
"packages",
|
|
1823
|
+
"plugin-codex",
|
|
1824
|
+
"memories_extensions",
|
|
1825
|
+
"remnic"
|
|
1826
|
+
);
|
|
1827
|
+
const searched = [];
|
|
1828
|
+
try {
|
|
1829
|
+
const moduleDir = path2.dirname(fileURLToPath(import.meta.url));
|
|
1830
|
+
const bundledCandidate = path2.join(moduleDir, "codex");
|
|
1831
|
+
searched.push(bundledCandidate);
|
|
1832
|
+
if (fs2.existsSync(bundledCandidate) && fs2.statSync(bundledCandidate).isDirectory()) {
|
|
1833
|
+
return bundledCandidate;
|
|
1834
|
+
}
|
|
1835
|
+
const distConnectorsCandidate = path2.join(moduleDir, "connectors", "codex");
|
|
1836
|
+
searched.push(distConnectorsCandidate);
|
|
1837
|
+
if (fs2.existsSync(distConnectorsCandidate) && fs2.statSync(distConnectorsCandidate).isDirectory()) {
|
|
1838
|
+
return distConnectorsCandidate;
|
|
1839
|
+
}
|
|
1840
|
+
} catch {
|
|
1841
|
+
}
|
|
1842
|
+
try {
|
|
1843
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
1844
|
+
const pluginPkgJsonPath = requireFromHere.resolve("@remnic/plugin-codex/package.json");
|
|
1845
|
+
const pluginPkgRoot = path2.dirname(pluginPkgJsonPath);
|
|
1846
|
+
const candidate = path2.join(pluginPkgRoot, EXTENSION_SUBPATH);
|
|
1847
|
+
searched.push(candidate);
|
|
1848
|
+
if (fs2.existsSync(candidate) && fs2.statSync(candidate).isDirectory()) {
|
|
1849
|
+
return candidate;
|
|
1850
|
+
}
|
|
1851
|
+
} catch {
|
|
1852
|
+
}
|
|
1853
|
+
try {
|
|
1854
|
+
const moduleDir = path2.dirname(fileURLToPath(import.meta.url));
|
|
1855
|
+
let dir = moduleDir;
|
|
1856
|
+
for (let depth = 0; depth < 8; depth += 1) {
|
|
1857
|
+
const candidate = path2.join(
|
|
1858
|
+
dir,
|
|
1859
|
+
"node_modules",
|
|
1860
|
+
"@remnic",
|
|
1861
|
+
"plugin-codex",
|
|
1862
|
+
EXTENSION_SUBPATH
|
|
1863
|
+
);
|
|
1864
|
+
searched.push(candidate);
|
|
1865
|
+
if (fs2.existsSync(candidate) && fs2.statSync(candidate).isDirectory()) {
|
|
1866
|
+
return candidate;
|
|
1867
|
+
}
|
|
1868
|
+
const parent = path2.dirname(dir);
|
|
1869
|
+
if (parent === dir) break;
|
|
1870
|
+
dir = parent;
|
|
1871
|
+
}
|
|
1872
|
+
} catch {
|
|
1873
|
+
}
|
|
1874
|
+
const anchors = [];
|
|
1875
|
+
try {
|
|
1876
|
+
anchors.push(path2.dirname(fileURLToPath(import.meta.url)));
|
|
1877
|
+
} catch {
|
|
1878
|
+
}
|
|
1879
|
+
anchors.push(process.cwd());
|
|
1880
|
+
for (const anchor of anchors) {
|
|
1881
|
+
let dir = anchor;
|
|
1882
|
+
for (let depth = 0; depth < 12; depth += 1) {
|
|
1883
|
+
const candidate = path2.join(dir, WORKSPACE_RELATIVE_PATH);
|
|
1884
|
+
searched.push(candidate);
|
|
1885
|
+
if (fs2.existsSync(candidate) && fs2.statSync(candidate).isDirectory()) {
|
|
1886
|
+
return candidate;
|
|
1887
|
+
}
|
|
1888
|
+
const parent = path2.dirname(dir);
|
|
1889
|
+
if (parent === dir) break;
|
|
1890
|
+
dir = parent;
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
throw new Error(
|
|
1894
|
+
"Could not locate the plugin-codex memories_extensions/remnic source directory.\nPaths searched:\n" + searched.map((p) => ` - ${p}`).join("\n") + "\nInstall @remnic/plugin-codex or pass sourceDir explicitly."
|
|
1895
|
+
);
|
|
1896
|
+
}
|
|
1897
|
+
function copyDirRecursiveSync(src, dest) {
|
|
1898
|
+
let count = 0;
|
|
1899
|
+
fs2.mkdirSync(dest, { recursive: true });
|
|
1900
|
+
const entries = fs2.readdirSync(src, { withFileTypes: true });
|
|
1901
|
+
for (const entry of entries) {
|
|
1902
|
+
const from = path2.join(src, entry.name);
|
|
1903
|
+
const to = path2.join(dest, entry.name);
|
|
1904
|
+
if (entry.isDirectory()) {
|
|
1905
|
+
count += copyDirRecursiveSync(from, to);
|
|
1906
|
+
} else if (entry.isFile()) {
|
|
1907
|
+
fs2.copyFileSync(from, to);
|
|
1908
|
+
count += 1;
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
return count;
|
|
1912
|
+
}
|
|
1913
|
+
function installCodexMemoryExtension(options = {}) {
|
|
1914
|
+
const paths = resolveCodexMemoryExtensionPaths(options.codexHome ?? null);
|
|
1915
|
+
const sourceDir = locatePluginCodexExtensionSource(options.sourceDir ?? null);
|
|
1916
|
+
fs2.mkdirSync(paths.extensionsRoot, { recursive: true });
|
|
1917
|
+
const tmpPrefix = `.${REMNIC_EXTENSION_DIR_NAME}.tmp-`;
|
|
1918
|
+
const STALE_TMP_THRESHOLD_MS = 10 * 60 * 1e3;
|
|
1919
|
+
const now = Date.now();
|
|
1920
|
+
try {
|
|
1921
|
+
const existingEntries = fs2.readdirSync(paths.extensionsRoot);
|
|
1922
|
+
for (const entry of existingEntries) {
|
|
1923
|
+
if (!entry.startsWith(tmpPrefix)) continue;
|
|
1924
|
+
const stalePath = path2.join(paths.extensionsRoot, entry);
|
|
1925
|
+
try {
|
|
1926
|
+
const stat = fs2.statSync(stalePath);
|
|
1927
|
+
const ageMs = now - stat.mtimeMs;
|
|
1928
|
+
if (ageMs < STALE_TMP_THRESHOLD_MS) {
|
|
1929
|
+
continue;
|
|
1930
|
+
}
|
|
1931
|
+
fs2.rmSync(stalePath, { recursive: true, force: true });
|
|
1932
|
+
} catch {
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
} catch {
|
|
1936
|
+
}
|
|
1937
|
+
const tmpName = `${tmpPrefix}${process.pid}-${Date.now()}`;
|
|
1938
|
+
const tmpDir = path2.join(paths.extensionsRoot, tmpName);
|
|
1939
|
+
let filesCopied = 0;
|
|
1940
|
+
let commitFn = () => {
|
|
1941
|
+
};
|
|
1942
|
+
let rollbackFn = () => {
|
|
1943
|
+
};
|
|
1944
|
+
try {
|
|
1945
|
+
filesCopied = copyDirRecursiveSync(sourceDir, tmpDir);
|
|
1946
|
+
const backupDir = `${paths.remnicExtensionDir}.bak-${Date.now()}`;
|
|
1947
|
+
const hadExisting = fs2.existsSync(paths.remnicExtensionDir);
|
|
1948
|
+
if (hadExisting) {
|
|
1949
|
+
fs2.renameSync(paths.remnicExtensionDir, backupDir);
|
|
1950
|
+
}
|
|
1951
|
+
try {
|
|
1952
|
+
fs2.renameSync(tmpDir, paths.remnicExtensionDir);
|
|
1953
|
+
} catch (renameErr) {
|
|
1954
|
+
if (hadExisting) {
|
|
1955
|
+
try {
|
|
1956
|
+
fs2.renameSync(backupDir, paths.remnicExtensionDir);
|
|
1957
|
+
} catch {
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
throw renameErr;
|
|
1961
|
+
}
|
|
1962
|
+
commitFn = () => {
|
|
1963
|
+
if (hadExisting) {
|
|
1964
|
+
try {
|
|
1965
|
+
fs2.rmSync(backupDir, { recursive: true, force: true });
|
|
1966
|
+
} catch {
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
};
|
|
1970
|
+
rollbackFn = () => {
|
|
1971
|
+
if (hadExisting) {
|
|
1972
|
+
try {
|
|
1973
|
+
if (fs2.existsSync(paths.remnicExtensionDir)) {
|
|
1974
|
+
fs2.rmSync(paths.remnicExtensionDir, { recursive: true, force: true });
|
|
1975
|
+
}
|
|
1976
|
+
fs2.renameSync(backupDir, paths.remnicExtensionDir);
|
|
1977
|
+
} catch {
|
|
1978
|
+
}
|
|
1979
|
+
} else {
|
|
1980
|
+
try {
|
|
1981
|
+
if (fs2.existsSync(paths.remnicExtensionDir)) {
|
|
1982
|
+
fs2.rmSync(paths.remnicExtensionDir, { recursive: true, force: true });
|
|
1983
|
+
}
|
|
1984
|
+
} catch {
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
} catch (err) {
|
|
1989
|
+
if (fs2.existsSync(tmpDir)) {
|
|
1990
|
+
try {
|
|
1991
|
+
fs2.rmSync(tmpDir, { recursive: true, force: true });
|
|
1992
|
+
} catch {
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
throw err;
|
|
1996
|
+
}
|
|
1997
|
+
const instructionsPath = path2.join(paths.remnicExtensionDir, "instructions.md");
|
|
1998
|
+
return {
|
|
1999
|
+
...paths,
|
|
2000
|
+
instructionsPath,
|
|
2001
|
+
filesCopied,
|
|
2002
|
+
commit: commitFn,
|
|
2003
|
+
rollback: rollbackFn
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
function removeCodexMemoryExtension(options = {}) {
|
|
2007
|
+
const paths = resolveCodexMemoryExtensionPaths(options.codexHome ?? null);
|
|
2008
|
+
let removed = false;
|
|
2009
|
+
if (fs2.existsSync(paths.remnicExtensionDir)) {
|
|
2010
|
+
fs2.rmSync(paths.remnicExtensionDir, { recursive: true, force: true });
|
|
2011
|
+
removed = true;
|
|
2012
|
+
}
|
|
2013
|
+
return { ...paths, removed };
|
|
2014
|
+
}
|
|
2015
|
+
function getConnectorsDir() {
|
|
2016
|
+
const xdgConfigHome = readEnvVar("XDG_CONFIG_HOME");
|
|
2017
|
+
const configDir = xdgConfigHome ? path2.join(xdgConfigHome, "engram") : path2.join(resolveHomeDir(), ".config", "engram");
|
|
2018
|
+
return path2.join(configDir, REGISTRY_DIR_NAME, "connectors");
|
|
2019
|
+
}
|
|
2020
|
+
var WECLONE_PROXY_CONFIG_DIRNAME = ".remnic";
|
|
2021
|
+
var WECLONE_PROXY_CONFIG_FILENAME = "weclone.json";
|
|
2022
|
+
function resolveWeCloneProxyConfigPath() {
|
|
2023
|
+
const remnicHome = readEnvVar("REMNIC_HOME");
|
|
2024
|
+
const override = remnicHome && remnicHome.length > 0 ? remnicHome : readEnvVar("ENGRAM_HOME");
|
|
2025
|
+
if (override && override.length > 0) {
|
|
2026
|
+
return path2.resolve(expandTildePath(override), "connectors", WECLONE_PROXY_CONFIG_FILENAME);
|
|
2027
|
+
}
|
|
2028
|
+
const envHome = readEnvVar("HOME");
|
|
2029
|
+
const home = envHome && envHome.length > 0 ? envHome : os.homedir();
|
|
2030
|
+
return path2.resolve(
|
|
2031
|
+
home,
|
|
2032
|
+
WECLONE_PROXY_CONFIG_DIRNAME,
|
|
2033
|
+
"connectors",
|
|
2034
|
+
WECLONE_PROXY_CONFIG_FILENAME
|
|
2035
|
+
);
|
|
2036
|
+
}
|
|
2037
|
+
function readWeCloneProxyConfigIfExists(configPath) {
|
|
2038
|
+
try {
|
|
2039
|
+
if (!fs2.existsSync(configPath)) return null;
|
|
2040
|
+
return fs2.readFileSync(configPath, "utf8");
|
|
2041
|
+
} catch {
|
|
2042
|
+
return null;
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
function safeParseJson(raw) {
|
|
2046
|
+
try {
|
|
2047
|
+
const parsed = JSON.parse(raw);
|
|
2048
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
2049
|
+
return parsed;
|
|
2050
|
+
}
|
|
2051
|
+
return null;
|
|
2052
|
+
} catch {
|
|
2053
|
+
return null;
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
var WECLONE_DEFAULTS = {
|
|
2057
|
+
wecloneApiUrl: "http://localhost:8000/v1",
|
|
2058
|
+
wecloneModelName: "weclone-avatar",
|
|
2059
|
+
proxyPort: 8100,
|
|
2060
|
+
remnicDaemonUrl: "http://localhost:4318",
|
|
2061
|
+
sessionStrategy: "single",
|
|
2062
|
+
memoryInjection: {
|
|
2063
|
+
maxTokens: 1500,
|
|
2064
|
+
position: "system-append",
|
|
2065
|
+
template: "[Memory Context]\n{memories}\n[End Memory Context]"
|
|
2066
|
+
}
|
|
2067
|
+
};
|
|
2068
|
+
function resolveStringField(userConfig, priorConfig, key, fallback) {
|
|
2069
|
+
const fromUser = userConfig[key];
|
|
2070
|
+
if (typeof fromUser === "string" && fromUser.length > 0) return fromUser;
|
|
2071
|
+
if (priorConfig) {
|
|
2072
|
+
const fromPrior = priorConfig[key];
|
|
2073
|
+
if (typeof fromPrior === "string" && fromPrior.length > 0) return fromPrior;
|
|
2074
|
+
}
|
|
2075
|
+
return fallback;
|
|
2076
|
+
}
|
|
2077
|
+
function coercePort(value) {
|
|
2078
|
+
if (typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 65535) {
|
|
2079
|
+
return value;
|
|
2080
|
+
}
|
|
2081
|
+
if (typeof value === "string" && value.length > 0) {
|
|
2082
|
+
const n = Number(value);
|
|
2083
|
+
if (Number.isInteger(n) && n >= 1 && n <= 65535) return n;
|
|
2084
|
+
}
|
|
2085
|
+
return null;
|
|
2086
|
+
}
|
|
2087
|
+
function resolvePort(userConfig, priorConfig, fallback) {
|
|
2088
|
+
const fromUser = coercePort(userConfig.proxyPort);
|
|
2089
|
+
if (fromUser !== null) return fromUser;
|
|
2090
|
+
if (priorConfig) {
|
|
2091
|
+
const fromPrior = coercePort(priorConfig.proxyPort);
|
|
2092
|
+
if (fromPrior !== null) return fromPrior;
|
|
2093
|
+
}
|
|
2094
|
+
return fallback;
|
|
2095
|
+
}
|
|
2096
|
+
function resolveSessionStrategy(userConfig, priorConfig) {
|
|
2097
|
+
const valid = /* @__PURE__ */ new Set(["caller-id", "single"]);
|
|
2098
|
+
const fromUser = userConfig.sessionStrategy;
|
|
2099
|
+
if (typeof fromUser === "string" && valid.has(fromUser)) {
|
|
2100
|
+
return fromUser;
|
|
2101
|
+
}
|
|
2102
|
+
if (priorConfig) {
|
|
2103
|
+
const fromPrior = priorConfig.sessionStrategy;
|
|
2104
|
+
if (typeof fromPrior === "string" && valid.has(fromPrior)) {
|
|
2105
|
+
return fromPrior;
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
return WECLONE_DEFAULTS.sessionStrategy;
|
|
2109
|
+
}
|
|
2110
|
+
function buildWeCloneProxyConfig(args) {
|
|
2111
|
+
const { userConfig, priorConfig, authToken } = args;
|
|
2112
|
+
const wecloneApiUrl = resolveStringField(
|
|
2113
|
+
userConfig,
|
|
2114
|
+
priorConfig,
|
|
2115
|
+
"wecloneApiUrl",
|
|
2116
|
+
WECLONE_DEFAULTS.wecloneApiUrl
|
|
2117
|
+
);
|
|
2118
|
+
const wecloneModelName = resolveStringField(
|
|
2119
|
+
userConfig,
|
|
2120
|
+
priorConfig,
|
|
2121
|
+
"wecloneModelName",
|
|
2122
|
+
WECLONE_DEFAULTS.wecloneModelName
|
|
2123
|
+
);
|
|
2124
|
+
const remnicDaemonUrl = resolveStringField(
|
|
2125
|
+
userConfig,
|
|
2126
|
+
priorConfig,
|
|
2127
|
+
"remnicDaemonUrl",
|
|
2128
|
+
WECLONE_DEFAULTS.remnicDaemonUrl
|
|
2129
|
+
);
|
|
2130
|
+
const proxyPort = resolvePort(
|
|
2131
|
+
userConfig,
|
|
2132
|
+
priorConfig,
|
|
2133
|
+
WECLONE_DEFAULTS.proxyPort
|
|
2134
|
+
);
|
|
2135
|
+
const sessionStrategy = resolveSessionStrategy(userConfig, priorConfig);
|
|
2136
|
+
const memoryInjection = {
|
|
2137
|
+
...WECLONE_DEFAULTS.memoryInjection,
|
|
2138
|
+
...priorConfig && typeof priorConfig.memoryInjection === "object" && priorConfig.memoryInjection !== null && !Array.isArray(priorConfig.memoryInjection) ? priorConfig.memoryInjection : {},
|
|
2139
|
+
...typeof userConfig.memoryInjection === "object" && userConfig.memoryInjection !== null && !Array.isArray(userConfig.memoryInjection) ? userConfig.memoryInjection : {}
|
|
2140
|
+
};
|
|
2141
|
+
const config = {
|
|
2142
|
+
wecloneApiUrl,
|
|
2143
|
+
wecloneModelName,
|
|
2144
|
+
proxyPort,
|
|
2145
|
+
remnicDaemonUrl,
|
|
2146
|
+
sessionStrategy,
|
|
2147
|
+
memoryInjection
|
|
2148
|
+
};
|
|
2149
|
+
if (authToken && authToken.length > 0) {
|
|
2150
|
+
config.remnicAuthToken = authToken;
|
|
2151
|
+
} else if (typeof userConfig.remnicAuthToken === "string" && userConfig.remnicAuthToken.length > 0) {
|
|
2152
|
+
config.remnicAuthToken = userConfig.remnicAuthToken;
|
|
2153
|
+
} else if (priorConfig && typeof priorConfig.remnicAuthToken === "string" && priorConfig.remnicAuthToken.length > 0) {
|
|
2154
|
+
config.remnicAuthToken = priorConfig.remnicAuthToken;
|
|
2155
|
+
}
|
|
2156
|
+
return config;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
export {
|
|
2160
|
+
MARKETPLACE_SCHEMA_VERSION,
|
|
2161
|
+
MARKETPLACE_MANIFEST_FILENAME,
|
|
2162
|
+
generateMarketplaceManifest,
|
|
2163
|
+
validateMarketplaceManifest,
|
|
2164
|
+
checkMarketplaceManifest,
|
|
2165
|
+
writeMarketplaceManifest,
|
|
2166
|
+
installFromMarketplace,
|
|
2167
|
+
getRegistryPath,
|
|
2168
|
+
loadRegistry,
|
|
2169
|
+
saveRegistry,
|
|
2170
|
+
listConnectors,
|
|
2171
|
+
getConnectorToken,
|
|
2172
|
+
installConnector,
|
|
2173
|
+
removeConnector,
|
|
2174
|
+
upsertHermesConfig,
|
|
2175
|
+
removeHermesConfig,
|
|
2176
|
+
doctorConnector,
|
|
2177
|
+
resolveCodexHome,
|
|
2178
|
+
resolveCodexMemoryExtensionPaths,
|
|
2179
|
+
locatePluginCodexExtensionSource,
|
|
2180
|
+
installCodexMemoryExtension,
|
|
2181
|
+
removeCodexMemoryExtension,
|
|
2182
|
+
resolveWeCloneProxyConfigPath,
|
|
2183
|
+
buildWeCloneProxyConfig
|
|
2184
|
+
};
|
|
2185
|
+
//# sourceMappingURL=chunk-326G7DJK.js.map
|