@remnic/core 1.1.11 → 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/README.md +3 -3
- package/dist/access-cli.d.ts +2 -1
- package/dist/access-cli.js +293 -104
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +31 -62
- package/dist/access-http.js +53 -35
- package/dist/access-mcp.d.ts +31 -8
- package/dist/access-mcp.js +45 -34
- package/dist/access-schema.d.ts +197 -14
- package/dist/access-schema.js +16 -5
- package/dist/access-service-DcCDmNYC.d.ts +1542 -0
- package/dist/access-service.d.ts +30 -9
- package/dist/access-service.js +42 -32
- package/dist/action-confidence.d.ts +83 -0
- package/dist/action-confidence.js +22 -0
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-memory-bridge.js +2 -2
- package/dist/active-recall.d.ts +1 -1
- 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/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +23 -6
- package/dist/boxes.d.ts +7 -0
- package/dist/boxes.js +1 -1
- package/dist/briefing.d.ts +5 -3
- package/dist/briefing.js +10 -7
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer-surprise-report.js +1 -1
- package/dist/buffer.d.ts +18 -4
- package/dist/buffer.js +1 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/calibration.js +6 -6
- 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 +9 -29
- 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 +2 -2
- package/dist/causal-consolidation.js +28 -17
- 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-4RA3C3EV.js +60 -0
- package/dist/chunk-4RA3C3EV.js.map +1 -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-5NXIJZFX.js +180 -0
- package/dist/chunk-5NXIJZFX.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-6NKAQ74D.js +2237 -0
- package/dist/chunk-6NKAQ74D.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-AC5LO7IU.js +308 -0
- package/dist/chunk-AC5LO7IU.js.map +1 -0
- package/dist/chunk-AGZQD76C.js +201 -0
- package/dist/chunk-AGZQD76C.js.map +1 -0
- package/dist/chunk-AH2JUU6X.js +336 -0
- package/dist/chunk-AH2JUU6X.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-C5BCH4ZS.js +317 -0
- package/dist/chunk-C5BCH4ZS.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-DB5A3NHS.js +906 -0
- package/dist/chunk-DB5A3NHS.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-EDTHC6UD.js.map +1 -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-FBYESMQ2.js.map +1 -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-MGKYQQYF.js.map +1 -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-OAZ5MFUB.js +4124 -0
- package/dist/chunk-OAZ5MFUB.js.map +1 -0
- package/dist/chunk-OIGNEXKZ.js +237 -0
- package/dist/chunk-OIGNEXKZ.js.map +1 -0
- package/dist/chunk-OZKZ2TRP.js +3729 -0
- package/dist/chunk-OZKZ2TRP.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-PD6O7AXF.js +110 -0
- package/dist/chunk-PD6O7AXF.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-PYPOFEMK.js +294 -0
- package/dist/chunk-PYPOFEMK.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-QDZ2RLEC.js +908 -0
- package/dist/chunk-QDZ2RLEC.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-RK6F44Y6.js +84 -0
- package/dist/chunk-RK6F44Y6.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-SOAU2OE2.js +125 -0
- package/dist/chunk-SOAU2OE2.js.map +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-V5OCT34X.js.map +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-VWT3F4IV.js +2161 -0
- package/dist/chunk-VWT3F4IV.js.map +1 -0
- package/dist/chunk-W3LR522O.js +2296 -0
- package/dist/chunk-W3LR522O.js.map +1 -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 +42 -10
- package/dist/cli.js +121 -58
- package/dist/codex-cli-fallback.d.ts +1 -0
- package/dist/codex-cli-fallback.js +1 -1
- 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/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +5 -3
- 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 +4 -2
- package/dist/consolidation-undo.d.ts +4 -2
- 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/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer-wiring.js +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- 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 +9 -6
- package/dist/entity-schema.d.ts +1 -1
- package/dist/evals.js +1 -1
- package/dist/event-order-recall.d.ts +17 -0
- package/dist/event-order-recall.js +11 -0
- package/dist/event-order-recall.js.map +1 -0
- package/dist/evidence-pack.d.ts +3 -1
- package/dist/evidence-pack.js +5 -3
- package/dist/explicit-capture.d.ts +23 -6
- package/dist/explicit-capture.js +2 -2
- package/dist/explicit-cue-recall.d.ts +4 -1
- package/dist/explicit-cue-recall.js +4 -2
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge-training.js +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/extraction.js +11 -10
- package/dist/faiss-adapter-CzPghc4C.d.ts +70 -0
- package/dist/fallback-llm.d.ts +4 -1
- package/dist/fallback-llm.js +6 -6
- package/dist/focused-list-recall.d.ts +17 -0
- package/dist/focused-list-recall.js +11 -0
- package/dist/focused-list-recall.js.map +1 -0
- package/dist/graph-edge-decay-5DI5GUNL.js +207 -0
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index-DJ9QWMw-.d.ts +35 -0
- package/dist/index.d.ts +107 -715
- package/dist/index.js +657 -2611
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +1 -1
- package/dist/intent.js +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/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/live-connectors-runner.js +5 -5
- package/dist/local-llm.d.ts +8 -4
- 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 +124 -0
- package/dist/mcp-memory-inspector-app.js +20 -0
- package/dist/mcp-memory-inspector-app.js.map +1 -0
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +108 -3
- package/dist/memory-projection-store.js +2 -1
- package/dist/memory-provenance.d.ts +57 -0
- package/dist/memory-provenance.js +13 -0
- package/dist/memory-provenance.js.map +1 -0
- 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/models-json.d.ts +1 -1
- 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/native-knowledge.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/objective-state-writers.js +2 -2
- package/dist/operator-toolkit.d.ts +4 -2
- package/dist/operator-toolkit.js +35 -17
- 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 +24 -7
- package/dist/orchestrator.js +107 -65
- package/dist/path-MR5JPYOP.js +9 -0
- package/dist/path-MR5JPYOP.js.map +1 -0
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +2 -2
- package/dist/qmd.d.ts +103 -4
- package/dist/qmd.js +23 -5
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +3 -1
- package/dist/recall-explain-renderer.js +5 -3
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +3 -1
- package/dist/recall-xray-cli.d.ts +3 -1
- package/dist/recall-xray-cli.js +6 -4
- package/dist/recall-xray-renderer.d.ts +3 -1
- package/dist/recall-xray-renderer.js +5 -3
- package/dist/recall-xray.d.ts +8 -1
- package/dist/recall-xray.js +4 -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-auth-token.d.ts +1 -1
- package/dist/resolve-provider-secret.js +2 -2
- package/dist/response-guidance-recall.d.ts +18 -0
- package/dist/response-guidance-recall.js +11 -0
- package/dist/response-guidance-recall.js.map +1 -0
- package/dist/resume-bundles.js +7 -5
- package/dist/retrieval-agents.d.ts +2 -2
- package/dist/retrieval-tiers.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/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 +3 -3
- package/dist/semantic-consolidation.js +15 -8
- package/dist/semantic-rule-promotion.js +9 -6
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +10 -7
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- 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/signal.d.ts +1 -1
- 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 +6 -2
- package/dist/storage.js +8 -5
- package/dist/summarizer.d.ts +6 -1
- package/dist/summarizer.js +11 -10
- package/dist/summary-snapshot.d.ts +1 -1
- 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/targeted-fact-recall.d.ts +17 -0
- package/dist/targeted-fact-recall.js +11 -0
- package/dist/targeted-fact-recall.js.map +1 -0
- package/dist/telemetry-transcript.d.ts +7 -0
- package/dist/telemetry-transcript.js +16 -0
- package/dist/telemetry-transcript.js.map +1 -0
- package/dist/temporal-supersession.d.ts +4 -2
- package/dist/temporal-supersession.js +2 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +6 -1
- package/dist/threading.js +2 -1
- package/dist/tier-migration.d.ts +5 -3
- package/dist/tier-routing.d.ts +1 -1
- package/dist/tokens.js +2 -2
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +16 -2
- 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/trust-zones.d.ts +3 -2
- package/dist/trust-zones.js +1 -1
- package/dist/types.d.ts +88 -3
- package/dist/types.js +1 -1
- package/dist/user-model.d.ts +37 -0
- package/dist/user-model.js +28 -0
- package/dist/user-model.js.map +1 -0
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +11 -8
- 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-BkXt3di1.d.ts +0 -2039
- package/dist/capsule-crypto-SJS5VVAP.js +0 -18
- package/dist/capsule-export-LLEVB2RG.js +0 -17
- package/dist/capsule-import-UW45R2MZ.js +0 -16
- package/dist/capsule-merge-DI7PNQ2H.js +0 -189
- package/dist/chunk-2LGMW3DJ.js +0 -111
- package/dist/chunk-2YMTO4ZJ.js +0 -265
- package/dist/chunk-2YMTO4ZJ.js.map +0 -1
- package/dist/chunk-363MWCD3.js +0 -9683
- package/dist/chunk-363MWCD3.js.map +0 -1
- package/dist/chunk-36CTNQY7.js +0 -1554
- package/dist/chunk-36CTNQY7.js.map +0 -1
- package/dist/chunk-457A4P3L.js +0 -119
- package/dist/chunk-457A4P3L.js.map +0 -1
- package/dist/chunk-4DXC6HQQ.js +0 -1837
- package/dist/chunk-4DXC6HQQ.js.map +0 -1
- package/dist/chunk-4IS4SXIQ.js +0 -2040
- package/dist/chunk-57QNCUEZ.js +0 -1914
- package/dist/chunk-57QNCUEZ.js.map +0 -1
- package/dist/chunk-6AUUAZEX.js +0 -150
- package/dist/chunk-6AUUAZEX.js.map +0 -1
- package/dist/chunk-6TBWYBJ3.js +0 -236
- package/dist/chunk-6XA7UN4Z.js +0 -135
- package/dist/chunk-6Z6UH6TK.js +0 -2129
- package/dist/chunk-6Z6UH6TK.js.map +0 -1
- package/dist/chunk-74EMIVE4.js +0 -329
- package/dist/chunk-74EMIVE4.js.map +0 -1
- package/dist/chunk-74WWN7ZW.js +0 -82
- package/dist/chunk-74WWN7ZW.js.map +0 -1
- package/dist/chunk-767ODGE6.js +0 -183
- package/dist/chunk-A4ACKWIW.js +0 -289
- package/dist/chunk-A4ACKWIW.js.map +0 -1
- package/dist/chunk-ASAITVLA.js +0 -64
- package/dist/chunk-ASAITVLA.js.map +0 -1
- package/dist/chunk-C5HUWVH2.js +0 -891
- package/dist/chunk-C5HUWVH2.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-E6K4NIEU.js +0 -747
- package/dist/chunk-E6K4NIEU.js.map +0 -1
- package/dist/chunk-EEQLFRUM.js +0 -89
- package/dist/chunk-EQINRHYR.js +0 -672
- package/dist/chunk-EQINRHYR.js.map +0 -1
- package/dist/chunk-ETOW6ACV.js +0 -158
- package/dist/chunk-ETOW6ACV.js.map +0 -1
- package/dist/chunk-EYNQTST2.js +0 -721
- 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-GGD5W7TB.js +0 -105
- package/dist/chunk-GGD5W7TB.js.map +0 -1
- package/dist/chunk-GVPWB7EY.js +0 -390
- package/dist/chunk-GVPWB7EY.js.map +0 -1
- package/dist/chunk-HJYHRE4S.js +0 -647
- package/dist/chunk-I6BQZSML.js +0 -1451
- package/dist/chunk-I6BQZSML.js.map +0 -1
- package/dist/chunk-IBX3VFOM.js +0 -446
- package/dist/chunk-IBX3VFOM.js.map +0 -1
- 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-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-KBYWQWSB.js +0 -271
- package/dist/chunk-KUHRUM6B.js +0 -14397
- package/dist/chunk-KUHRUM6B.js.map +0 -1
- package/dist/chunk-KWBPHZUU.js +0 -83
- package/dist/chunk-KWBPHZUU.js.map +0 -1
- package/dist/chunk-LIO5X3CM.js +0 -596
- package/dist/chunk-MARWOCVP.js +0 -48
- package/dist/chunk-MCC6KDQF.js +0 -5095
- package/dist/chunk-MCC6KDQF.js.map +0 -1
- package/dist/chunk-N5AKDXAI.js +0 -74
- package/dist/chunk-NN3LPQ5D.js +0 -936
- package/dist/chunk-NN3LPQ5D.js.map +0 -1
- package/dist/chunk-O4XJUPSF.js +0 -533
- package/dist/chunk-O4XJUPSF.js.map +0 -1
- 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-P73JTV34.js +0 -275
- package/dist/chunk-P73JTV34.js.map +0 -1
- package/dist/chunk-P77UEOU2.js +0 -1521
- package/dist/chunk-P77UEOU2.js.map +0 -1
- package/dist/chunk-PB5KW5PL.js +0 -118
- package/dist/chunk-PHNGXFQ6.js +0 -623
- package/dist/chunk-PHNGXFQ6.js.map +0 -1
- package/dist/chunk-QIGOEM65.js +0 -228
- package/dist/chunk-RXTFCYQF.js +0 -108
- package/dist/chunk-S2JJBLJG.js +0 -2101
- package/dist/chunk-S2JJBLJG.js.map +0 -1
- package/dist/chunk-S3IP6R6K.js +0 -219
- package/dist/chunk-S3IP6R6K.js.map +0 -1
- package/dist/chunk-SRBJUAMP.js +0 -403
- package/dist/chunk-SRBJUAMP.js.map +0 -1
- package/dist/chunk-URB2WSKZ.js +0 -350
- package/dist/chunk-URB2WSKZ.js.map +0 -1
- package/dist/chunk-VQXK37XA.js +0 -26
- package/dist/chunk-VQXK37XA.js.map +0 -1
- package/dist/chunk-VTU2B4VF.js +0 -146
- package/dist/chunk-VTU2B4VF.js.map +0 -1
- package/dist/chunk-VX2IUQFE.js +0 -613
- package/dist/chunk-VX2IUQFE.js.map +0 -1
- package/dist/chunk-WGK4VHGP.js +0 -4292
- package/dist/chunk-WGK4VHGP.js.map +0 -1
- package/dist/chunk-WTFWLUSX.js +0 -827
- package/dist/chunk-WTFWLUSX.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-Y5KDIOKF.js +0 -2403
- package/dist/chunk-Y5KDIOKF.js.map +0 -1
- 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-Z5S5HNGY.js +0 -2280
- package/dist/chunk-Z5S5HNGY.js.map +0 -1
- package/dist/chunk-ZL4S7ARC.js +0 -53
- package/dist/chunk-ZTSE2ZJ6.js +0 -190
- package/dist/chunk-ZTSE2ZJ6.js.map +0 -1
- package/dist/cli-Cvy2SNhF.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-3Z6YW7YA.js +0 -413
- package/dist/contradiction-scan-3Z6YW7YA.js.map +0 -1
- package/dist/engine-FOC3IJLA.js +0 -28
- package/dist/fs-utils-IRVUFB6G.js +0 -30
- package/dist/graph-edge-decay-PWB63GRE.js +0 -207
- package/dist/index-1qIcnbG1.d.ts +0 -34
- package/dist/memory-governance-F3QOJGEY.js +0 -37
- package/dist/memory-projection-store-CY8TU40w.d.ts +0 -222
- package/dist/orchestrator-AOQMo7QI.d.ts +0 -1784
- 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 → action-confidence.js.map} +0 -0
- /package/dist/{capsule-export-LLEVB2RG.js.map → adapters/claude-code.js.map} +0 -0
- /package/dist/{capsule-import-UW45R2MZ.js.map → adapters/codex.js.map} +0 -0
- /package/dist/{contradiction-review-5LTTVDQV.js.map → adapters/hermes.js.map} +0 -0
- /package/dist/{engine-FOC3IJLA.js.map → adapters/index.js.map} +0 -0
- /package/dist/{fs-utils-IRVUFB6G.js.map → adapters/registry.js.map} +0 -0
- /package/dist/{memory-governance-F3QOJGEY.js.map → adapters/replit.js.map} +0 -0
- /package/dist/{path-RMTY5Y5A.js.map → adapters/types.js.map} +0 -0
- /package/dist/{secure-store-4R2GSO7S.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-KBYWQWSB.js.map → chunk-4CRG46BG.js.map} +0 -0
- /package/dist/{chunk-LIO5X3CM.js.map → chunk-7IASACLB.js.map} +0 -0
- /package/dist/{chunk-EYNQTST2.js.map → chunk-EFJ3MQ4V.js.map} +0 -0
- /package/dist/{chunk-D54LZC5L.js.map → chunk-FDU6HUUL.js.map} +0 -0
- /package/dist/{chunk-QIGOEM65.js.map → chunk-GGKRUQOO.js.map} +0 -0
- /package/dist/{chunk-HJYHRE4S.js.map → chunk-GL6I6MEQ.js.map} +0 -0
- /package/dist/{state-store-3EH7HYIN.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-PB5KW5PL.js.map → chunk-MC26UJIM.js.map} +0 -0
- /package/dist/{chunk-ZL4S7ARC.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-RXTFCYQF.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/{types-V3FJ26TF.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/{chunk-MARWOCVP.js.map → chunk-XIG5PDM7.js.map} +0 -0
- /package/dist/{chunk-6XA7UN4Z.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,1068 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @remnic/core — GitHub live connector (issue #683 PR 5/6)
|
|
3
|
+
*
|
|
4
|
+
* Concrete `LiveConnector` implementation that incrementally imports notes
|
|
5
|
+
* from a user's GitHub activity into Remnic. Fetches via the GitHub REST
|
|
6
|
+
* API using raw `fetch` with a personal access token — no octokit dep,
|
|
7
|
+
* per à-la-carte packaging rules (CLAUDE.md gotcha #57).
|
|
8
|
+
*
|
|
9
|
+
* What is imported:
|
|
10
|
+
* - Issue comments authored by `userLogin` on watched repos.
|
|
11
|
+
* - PR review comments authored by `userLogin` on watched repos.
|
|
12
|
+
* - Discussion comments authored by `userLogin` (optional, off by default).
|
|
13
|
+
*
|
|
14
|
+
* Design notes:
|
|
15
|
+
*
|
|
16
|
+
* - **Auth.** GitHub personal access token via `connectors.github.token`.
|
|
17
|
+
* The token is accepted at config-parse time but never logged. Operators
|
|
18
|
+
* must populate it from a secret store; no real value may appear in
|
|
19
|
+
* tests, fixtures, or comments.
|
|
20
|
+
*
|
|
21
|
+
* - **Cursor semantics.** The cursor encodes a per-repo, per-resource-type
|
|
22
|
+
* watermark (latest `updated_at` ISO 8601 string seen). On the very first
|
|
23
|
+
* sync (cursor=null) we seed the watermark from the current latest
|
|
24
|
+
* comment timestamp WITHOUT importing any content — mirrors Drive's
|
|
25
|
+
* `getStartPageToken` bootstrap pattern. Subsequent passes only import
|
|
26
|
+
* items created/updated after the stored watermark.
|
|
27
|
+
*
|
|
28
|
+
* - **Watermark field.** All three GitHub resource types expose
|
|
29
|
+
* `updated_at` at the comment level. We always use `updated_at` (not
|
|
30
|
+
* `created_at`) so edits re-trigger ingestion.
|
|
31
|
+
*
|
|
32
|
+
* - **Raw `fetch`.** We call `https://api.github.com/…` directly.
|
|
33
|
+
* `Authorization: Bearer <token>` + `User-Agent: remnic-connector` headers
|
|
34
|
+
* on every request. The `fetchFn` parameter is the test injection point —
|
|
35
|
+
* production callers omit it and the connector uses the global `fetch`.
|
|
36
|
+
*
|
|
37
|
+
* - **Idempotency.** `ConnectorDocument.source.externalId` is
|
|
38
|
+
* `{repo}/{kind}/{commentId}` and `externalRevision` is `updated_at`, so
|
|
39
|
+
* downstream dedup (CLAUDE.md gotcha #44) can recognise repeat fetches.
|
|
40
|
+
*
|
|
41
|
+
* - **Filtering by userLogin.** GitHub's `/issues/comments` endpoint does
|
|
42
|
+
* not support server-side author filtering in the public API. We filter
|
|
43
|
+
* client-side by comparing `comment.user.login` to the configured
|
|
44
|
+
* `userLogin`. This keeps the implementation free from authenticated
|
|
45
|
+
* user lookups and avoids an extra round-trip on first run.
|
|
46
|
+
*
|
|
47
|
+
* - **Privacy.** No comment body is ever logged. Repo names and counts
|
|
48
|
+
* may be logged. The token is never exposed in logs, state, or errors.
|
|
49
|
+
*
|
|
50
|
+
* - **Read-only.** This connector only reads. It never posts, edits,
|
|
51
|
+
* reacts to, or otherwise mutates any GitHub resource.
|
|
52
|
+
*
|
|
53
|
+
* - **Error classification.** 429/5xx → transient (re-throw, cursor
|
|
54
|
+
* does NOT advance). 404/403/410 → terminal (skip repo/resource,
|
|
55
|
+
* continue). Network errors → transient.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
import type {
|
|
59
|
+
ConnectorConfig,
|
|
60
|
+
ConnectorCursor,
|
|
61
|
+
ConnectorDocument,
|
|
62
|
+
LiveConnector,
|
|
63
|
+
SyncIncrementalArgs,
|
|
64
|
+
SyncIncrementalResult,
|
|
65
|
+
} from "./framework.js";
|
|
66
|
+
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
// Public constants
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
/** Stable connector id. */
|
|
72
|
+
export const GITHUB_CONNECTOR_ID = "github";
|
|
73
|
+
|
|
74
|
+
/** Cursor `kind` emitted by this connector. */
|
|
75
|
+
export const GITHUB_CURSOR_KIND = "githubWatermark";
|
|
76
|
+
|
|
77
|
+
/** Default poll interval: 5 minutes. */
|
|
78
|
+
export const GITHUB_DEFAULT_POLL_INTERVAL_MS = 5 * 60 * 1000;
|
|
79
|
+
|
|
80
|
+
/** Hard cap on poll interval: 24 hours. */
|
|
81
|
+
const GITHUB_MAX_POLL_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
82
|
+
|
|
83
|
+
/** Hard cap on body text we'll accept for a single comment. */
|
|
84
|
+
const MAX_BODY_BYTES = 5 * 1024 * 1024;
|
|
85
|
+
|
|
86
|
+
/** Maximum number of items (across all repos and resource types) per pass. */
|
|
87
|
+
const MAX_ITEMS_PER_PASS = 200;
|
|
88
|
+
|
|
89
|
+
/** Page size for GitHub list requests. Maximum allowed by the API. */
|
|
90
|
+
const GITHUB_PAGE_SIZE = 100;
|
|
91
|
+
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// Config types
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Validated, frozen view of `connectors.github.*`.
|
|
98
|
+
*/
|
|
99
|
+
export interface GitHubConnectorConfig {
|
|
100
|
+
/** Personal access token. Populate from a secret store; never commit. */
|
|
101
|
+
readonly token: string;
|
|
102
|
+
/** Only import comments authored by this GitHub login. Required. */
|
|
103
|
+
readonly userLogin: string;
|
|
104
|
+
/** Repos to poll, in `owner/repo` format. */
|
|
105
|
+
readonly repos: readonly string[];
|
|
106
|
+
/** Poll interval in ms. */
|
|
107
|
+
readonly pollIntervalMs: number;
|
|
108
|
+
/** Whether to import Discussion comments. Default false. */
|
|
109
|
+
readonly includeDiscussions: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
// Cursor payload
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* JSON payload encoded into `ConnectorCursor.value`.
|
|
118
|
+
*
|
|
119
|
+
* Watermarks are stored per repo per resource kind. We use ISO 8601 strings
|
|
120
|
+
* (which sort lexicographically) for all comparisons — no epoch math needed.
|
|
121
|
+
*/
|
|
122
|
+
interface GitHubCursorPayload {
|
|
123
|
+
/**
|
|
124
|
+
* Maps `{repo}/{kind}` → latest `updated_at` ISO string already ingested.
|
|
125
|
+
* `kind` is one of `"issue-comment"`, `"pr-review-comment"`, `"discussion"`.
|
|
126
|
+
*/
|
|
127
|
+
watermarks: Record<string, string>;
|
|
128
|
+
/**
|
|
129
|
+
* Same-second dedup map: maps `{repo}/{kind}/{commentId}` → `updated_at`
|
|
130
|
+
* ISO string for every comment processed within the same second as the
|
|
131
|
+
* current watermark. Cleared when the watermark advances past that second
|
|
132
|
+
* boundary. Prevents re-importing comments whose `updated_at` matches the
|
|
133
|
+
* watermark exactly — GitHub's `since=` filter is inclusive, so comments at
|
|
134
|
+
* the exact watermark timestamp are re-returned on every subsequent poll.
|
|
135
|
+
*
|
|
136
|
+
* Mirrors the Gmail connector's `seenIds` pattern from #745.
|
|
137
|
+
*/
|
|
138
|
+
seenIds: Record<string, string>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
// GitHub API response shapes (only the fields we consume)
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
export interface GitHubComment {
|
|
146
|
+
readonly id: number;
|
|
147
|
+
readonly body?: string | null;
|
|
148
|
+
readonly user?: { readonly login?: string | null } | null;
|
|
149
|
+
readonly created_at: string;
|
|
150
|
+
readonly updated_at: string;
|
|
151
|
+
readonly html_url?: string | null;
|
|
152
|
+
/** Present on PR review comments. */
|
|
153
|
+
readonly pull_request_url?: string | null;
|
|
154
|
+
/** Present on issue comments. */
|
|
155
|
+
readonly issue_url?: string | null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface GitHubDiscussionComment {
|
|
159
|
+
readonly id: number;
|
|
160
|
+
readonly body?: string | null;
|
|
161
|
+
readonly author?: { readonly login?: string | null } | null;
|
|
162
|
+
readonly createdAt?: string | null;
|
|
163
|
+
readonly updatedAt?: string | null;
|
|
164
|
+
readonly url?: string | null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
// Fetch abstraction (test hook)
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Minimal fetch-compatible surface used by the connector. Tests inject a
|
|
173
|
+
* stub; production delegates to global `fetch`.
|
|
174
|
+
*/
|
|
175
|
+
export type GitHubFetchFn = (
|
|
176
|
+
url: string,
|
|
177
|
+
init: {
|
|
178
|
+
method: string;
|
|
179
|
+
headers: Record<string, string>;
|
|
180
|
+
signal?: AbortSignal;
|
|
181
|
+
},
|
|
182
|
+
) => Promise<{
|
|
183
|
+
ok: boolean;
|
|
184
|
+
status: number;
|
|
185
|
+
headers: { get(name: string): string | null };
|
|
186
|
+
json(): Promise<unknown>;
|
|
187
|
+
}>;
|
|
188
|
+
|
|
189
|
+
// ---------------------------------------------------------------------------
|
|
190
|
+
// Config validation
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
|
|
193
|
+
/** Pattern for `owner/repo`. Both segments allow alphanumeric + `-` + `_` + `.`. */
|
|
194
|
+
const REPO_SLUG_PATTERN = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Validate and normalise raw config. Throws with a concrete message on any
|
|
198
|
+
* malformed input — never silently defaults (CLAUDE.md gotcha #51).
|
|
199
|
+
*/
|
|
200
|
+
export function validateGitHubConfig(raw: unknown): GitHubConnectorConfig {
|
|
201
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
202
|
+
throw new TypeError(
|
|
203
|
+
`github: config must be an object, got ${raw === null ? "null" : Array.isArray(raw) ? "array" : typeof raw}`,
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
const r = raw as Record<string, unknown>;
|
|
207
|
+
|
|
208
|
+
// token
|
|
209
|
+
if (typeof r.token !== "string") {
|
|
210
|
+
throw new TypeError(`github: token must be a string (got ${typeof r.token})`);
|
|
211
|
+
}
|
|
212
|
+
const token = r.token.trim();
|
|
213
|
+
if (token.length === 0) {
|
|
214
|
+
throw new RangeError("github: token must be non-empty");
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// userLogin
|
|
218
|
+
if (typeof r.userLogin !== "string") {
|
|
219
|
+
throw new TypeError(`github: userLogin must be a string (got ${typeof r.userLogin})`);
|
|
220
|
+
}
|
|
221
|
+
const userLogin = r.userLogin.trim();
|
|
222
|
+
if (userLogin.length === 0) {
|
|
223
|
+
throw new RangeError("github: userLogin must be non-empty");
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// pollIntervalMs
|
|
227
|
+
let pollIntervalMs: number;
|
|
228
|
+
if (r.pollIntervalMs === undefined) {
|
|
229
|
+
pollIntervalMs = GITHUB_DEFAULT_POLL_INTERVAL_MS;
|
|
230
|
+
} else if (typeof r.pollIntervalMs !== "number" || !Number.isFinite(r.pollIntervalMs)) {
|
|
231
|
+
throw new TypeError(
|
|
232
|
+
`github: pollIntervalMs must be a finite number (got ${JSON.stringify(r.pollIntervalMs)})`,
|
|
233
|
+
);
|
|
234
|
+
} else if (!Number.isInteger(r.pollIntervalMs)) {
|
|
235
|
+
throw new TypeError(`github: pollIntervalMs must be an integer (got ${r.pollIntervalMs})`);
|
|
236
|
+
} else if (r.pollIntervalMs < 1_000) {
|
|
237
|
+
throw new RangeError(`github: pollIntervalMs must be ≥1000ms; got ${r.pollIntervalMs}`);
|
|
238
|
+
} else if (r.pollIntervalMs > GITHUB_MAX_POLL_INTERVAL_MS) {
|
|
239
|
+
throw new RangeError(
|
|
240
|
+
`github: pollIntervalMs must be ≤${GITHUB_MAX_POLL_INTERVAL_MS} (24h); got ${r.pollIntervalMs}`,
|
|
241
|
+
);
|
|
242
|
+
} else {
|
|
243
|
+
pollIntervalMs = r.pollIntervalMs;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// repos
|
|
247
|
+
let repos: readonly string[] = [];
|
|
248
|
+
if (r.repos !== undefined) {
|
|
249
|
+
if (!Array.isArray(r.repos)) {
|
|
250
|
+
throw new TypeError(
|
|
251
|
+
`github: repos must be an array of strings (got ${typeof r.repos})`,
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
const seen = new Set<string>();
|
|
255
|
+
const out: string[] = [];
|
|
256
|
+
for (const value of r.repos) {
|
|
257
|
+
if (typeof value !== "string") {
|
|
258
|
+
throw new TypeError(
|
|
259
|
+
`github: repos entries must be strings; found ${typeof value}`,
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
const trimmed = value.trim();
|
|
263
|
+
if (!REPO_SLUG_PATTERN.test(trimmed)) {
|
|
264
|
+
throw new RangeError(
|
|
265
|
+
`github: repos entry ${JSON.stringify(value)} is not a valid "owner/repo" slug`,
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
// Dedupe per CLAUDE.md gotcha #49.
|
|
269
|
+
if (seen.has(trimmed)) continue;
|
|
270
|
+
seen.add(trimmed);
|
|
271
|
+
out.push(trimmed);
|
|
272
|
+
}
|
|
273
|
+
repos = Object.freeze(out);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// includeDiscussions (optional, default false)
|
|
277
|
+
let includeDiscussions = false;
|
|
278
|
+
if (r.includeDiscussions !== undefined) {
|
|
279
|
+
if (typeof r.includeDiscussions !== "boolean") {
|
|
280
|
+
throw new TypeError(
|
|
281
|
+
`github: includeDiscussions must be a boolean (got ${typeof r.includeDiscussions})`,
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
includeDiscussions = r.includeDiscussions;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return Object.freeze({
|
|
288
|
+
token,
|
|
289
|
+
userLogin,
|
|
290
|
+
repos,
|
|
291
|
+
pollIntervalMs,
|
|
292
|
+
includeDiscussions,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// ---------------------------------------------------------------------------
|
|
297
|
+
// Cursor helpers
|
|
298
|
+
// ---------------------------------------------------------------------------
|
|
299
|
+
|
|
300
|
+
function makeCursor(payload: GitHubCursorPayload): ConnectorCursor {
|
|
301
|
+
return {
|
|
302
|
+
kind: GITHUB_CURSOR_KIND,
|
|
303
|
+
value: JSON.stringify(payload),
|
|
304
|
+
updatedAt: new Date().toISOString(),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function parseCursorPayload(cursor: ConnectorCursor): GitHubCursorPayload {
|
|
309
|
+
if (cursor.kind !== GITHUB_CURSOR_KIND) {
|
|
310
|
+
throw new Error(
|
|
311
|
+
`github: unexpected cursor kind ${JSON.stringify(cursor.kind)}; expected ${GITHUB_CURSOR_KIND}`,
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
// CLAUDE.md gotcha #18: validate after parse.
|
|
315
|
+
let parsed: unknown;
|
|
316
|
+
try {
|
|
317
|
+
parsed = JSON.parse(cursor.value);
|
|
318
|
+
} catch {
|
|
319
|
+
throw new Error(`github: cursor value is not valid JSON`);
|
|
320
|
+
}
|
|
321
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
322
|
+
throw new Error(`github: cursor value does not match GitHubCursorPayload shape`);
|
|
323
|
+
}
|
|
324
|
+
const p = parsed as Record<string, unknown>;
|
|
325
|
+
const watermarks =
|
|
326
|
+
typeof p.watermarks === "object" && p.watermarks !== null && !Array.isArray(p.watermarks)
|
|
327
|
+
? (p.watermarks as Record<string, string>)
|
|
328
|
+
: {};
|
|
329
|
+
// seenIds: tolerate missing key (old cursors lack it).
|
|
330
|
+
const seenIds: Record<string, string> =
|
|
331
|
+
typeof p.seenIds === "object" && p.seenIds !== null && !Array.isArray(p.seenIds)
|
|
332
|
+
? (p.seenIds as Record<string, string>)
|
|
333
|
+
: {};
|
|
334
|
+
return { watermarks, seenIds };
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function watermarkKey(repo: string, kind: string): string {
|
|
338
|
+
return `${repo}/${kind}`;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// ---------------------------------------------------------------------------
|
|
342
|
+
// Error classification
|
|
343
|
+
// ---------------------------------------------------------------------------
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Classify a fetch error as transient (re-throw — cursor does NOT advance,
|
|
347
|
+
* next poll retries) vs. terminal (skip this repo/resource and continue).
|
|
348
|
+
*
|
|
349
|
+
* Transient:
|
|
350
|
+
* - 429 (rate-limit — retry after backoff)
|
|
351
|
+
* - 5xx (GitHub backend error)
|
|
352
|
+
* - AbortError / network-layer errors
|
|
353
|
+
*
|
|
354
|
+
* Terminal (skip-and-continue):
|
|
355
|
+
* - 404 (repo deleted, comment gone, or no access)
|
|
356
|
+
* - 403 (permission denied)
|
|
357
|
+
* - 410 (gone)
|
|
358
|
+
* - any other 4xx that isn't 429
|
|
359
|
+
*/
|
|
360
|
+
export function isTransientGitHubError(err: unknown): boolean {
|
|
361
|
+
if (err === null || typeof err !== "object") return false;
|
|
362
|
+
const e = err as {
|
|
363
|
+
name?: unknown;
|
|
364
|
+
code?: unknown;
|
|
365
|
+
status?: unknown;
|
|
366
|
+
githubStatus?: unknown;
|
|
367
|
+
message?: unknown;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
// AbortError
|
|
371
|
+
if (typeof e.name === "string" && e.name === "AbortError") return true;
|
|
372
|
+
|
|
373
|
+
// HTTP status attached by our own error-throwing code.
|
|
374
|
+
const status = pickNumericGitHubStatus(e);
|
|
375
|
+
if (status !== undefined) {
|
|
376
|
+
if (status === 429) return true;
|
|
377
|
+
if (status >= 500 && status <= 599) return true;
|
|
378
|
+
// Any classified 4xx that isn't 429 is terminal.
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Network-layer error codes.
|
|
383
|
+
const codeStr = typeof e.code === "string" ? e.code : undefined;
|
|
384
|
+
if (codeStr !== undefined) {
|
|
385
|
+
const transientCodes = new Set([
|
|
386
|
+
"ECONNRESET",
|
|
387
|
+
"ECONNREFUSED",
|
|
388
|
+
"ECONNABORTED",
|
|
389
|
+
"ETIMEDOUT",
|
|
390
|
+
"ESOCKETTIMEDOUT",
|
|
391
|
+
"ENOTFOUND",
|
|
392
|
+
"EAI_AGAIN",
|
|
393
|
+
"EPIPE",
|
|
394
|
+
"EHOSTUNREACH",
|
|
395
|
+
"ENETUNREACH",
|
|
396
|
+
"ENETDOWN",
|
|
397
|
+
"ERR_NETWORK",
|
|
398
|
+
"ERR_NETWORK_CHANGED",
|
|
399
|
+
]);
|
|
400
|
+
if (transientCodes.has(codeStr)) return true;
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// No status, no code — treat as transient (plain network failures).
|
|
405
|
+
return true;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function pickNumericGitHubStatus(e: {
|
|
409
|
+
status?: unknown;
|
|
410
|
+
githubStatus?: unknown;
|
|
411
|
+
code?: unknown;
|
|
412
|
+
}): number | undefined {
|
|
413
|
+
if (typeof e.githubStatus === "number" && Number.isFinite(e.githubStatus)) {
|
|
414
|
+
return e.githubStatus;
|
|
415
|
+
}
|
|
416
|
+
if (typeof e.status === "number" && Number.isFinite(e.status)) {
|
|
417
|
+
return e.status;
|
|
418
|
+
}
|
|
419
|
+
return undefined;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// ---------------------------------------------------------------------------
|
|
423
|
+
// GitHub API client helpers
|
|
424
|
+
// ---------------------------------------------------------------------------
|
|
425
|
+
|
|
426
|
+
const GITHUB_API_BASE = "https://api.github.com";
|
|
427
|
+
|
|
428
|
+
function throwIfAborted(signal: AbortSignal | undefined): void {
|
|
429
|
+
if (signal?.aborted) {
|
|
430
|
+
const err = new Error("github: sync aborted");
|
|
431
|
+
err.name = "AbortError";
|
|
432
|
+
throw err;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function makeGitHubApiError(status: number, message: string): Error & { githubStatus: number } {
|
|
437
|
+
const err = new Error(`github: HTTP ${status}: ${message}`) as Error & {
|
|
438
|
+
githubStatus: number;
|
|
439
|
+
};
|
|
440
|
+
err.githubStatus = status;
|
|
441
|
+
return err;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Execute a GET request against the GitHub REST API. Returns the parsed JSON
|
|
446
|
+
* body on success. Throws a structured error on non-2xx responses.
|
|
447
|
+
*/
|
|
448
|
+
async function githubGet(
|
|
449
|
+
fetchFn: GitHubFetchFn,
|
|
450
|
+
token: string,
|
|
451
|
+
url: string,
|
|
452
|
+
signal: AbortSignal | undefined,
|
|
453
|
+
): Promise<unknown> {
|
|
454
|
+
const res = await fetchFn(url, {
|
|
455
|
+
method: "GET",
|
|
456
|
+
headers: {
|
|
457
|
+
Authorization: `Bearer ${token}`,
|
|
458
|
+
"User-Agent": "remnic-connector",
|
|
459
|
+
Accept: "application/vnd.github+json",
|
|
460
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
461
|
+
},
|
|
462
|
+
signal,
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
const data = await res.json();
|
|
466
|
+
if (!res.ok) {
|
|
467
|
+
const message =
|
|
468
|
+
typeof data === "object" &&
|
|
469
|
+
data !== null &&
|
|
470
|
+
typeof (data as Record<string, unknown>).message === "string"
|
|
471
|
+
? ((data as Record<string, unknown>).message as string)
|
|
472
|
+
: `HTTP ${res.status}`;
|
|
473
|
+
throw makeGitHubApiError(res.status, message);
|
|
474
|
+
}
|
|
475
|
+
return data;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// ---------------------------------------------------------------------------
|
|
479
|
+
// Sync result type
|
|
480
|
+
// ---------------------------------------------------------------------------
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Result of a single sync pass. Superset of `SyncIncrementalResult` for
|
|
484
|
+
* richer test assertions.
|
|
485
|
+
*/
|
|
486
|
+
export interface GitHubSyncResult extends SyncIncrementalResult {
|
|
487
|
+
readonly skippedOtherAuthor: number;
|
|
488
|
+
readonly skippedEmpty: number;
|
|
489
|
+
readonly skippedTooLarge: number;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// ---------------------------------------------------------------------------
|
|
493
|
+
// Connector factory
|
|
494
|
+
// ---------------------------------------------------------------------------
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Construct the GitHub connector. `fetchFn` is the test hook — production
|
|
498
|
+
* callers omit it and the connector delegates to global `fetch`.
|
|
499
|
+
*/
|
|
500
|
+
export function createGitHubConnector(
|
|
501
|
+
options: { fetchFn?: GitHubFetchFn } = {},
|
|
502
|
+
): LiveConnector {
|
|
503
|
+
const fetchFn: GitHubFetchFn =
|
|
504
|
+
options.fetchFn ??
|
|
505
|
+
(globalThis.fetch as unknown as GitHubFetchFn);
|
|
506
|
+
|
|
507
|
+
return {
|
|
508
|
+
id: GITHUB_CONNECTOR_ID,
|
|
509
|
+
displayName: "GitHub",
|
|
510
|
+
description:
|
|
511
|
+
"Imports issue comments, PR review comments, and discussion posts authored by the configured user from watched repos into Remnic.",
|
|
512
|
+
|
|
513
|
+
validateConfig(raw: unknown): ConnectorConfig {
|
|
514
|
+
return validateGitHubConfig(raw) as unknown as ConnectorConfig;
|
|
515
|
+
},
|
|
516
|
+
|
|
517
|
+
async syncIncremental(args: SyncIncrementalArgs): Promise<SyncIncrementalResult> {
|
|
518
|
+
const config = validateGitHubConfig(args.config);
|
|
519
|
+
throwIfAborted(args.abortSignal);
|
|
520
|
+
|
|
521
|
+
// Short-circuit: nothing to do if no repos are configured.
|
|
522
|
+
if (config.repos.length === 0) {
|
|
523
|
+
const emptyPayload: GitHubCursorPayload = { watermarks: {}, seenIds: {} };
|
|
524
|
+
const result: GitHubSyncResult = {
|
|
525
|
+
newDocs: [],
|
|
526
|
+
nextCursor: makeCursor(emptyPayload),
|
|
527
|
+
skippedOtherAuthor: 0,
|
|
528
|
+
skippedEmpty: 0,
|
|
529
|
+
skippedTooLarge: 0,
|
|
530
|
+
};
|
|
531
|
+
return result;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// Parse or seed cursor.
|
|
535
|
+
const isFirstSync = args.cursor === null;
|
|
536
|
+
const payload: GitHubCursorPayload = isFirstSync
|
|
537
|
+
? { watermarks: {}, seenIds: {} }
|
|
538
|
+
: parseCursorPayload(args.cursor);
|
|
539
|
+
|
|
540
|
+
if (isFirstSync) {
|
|
541
|
+
const seededPayload = await seedWatermarks(fetchFn, config, payload, args.abortSignal);
|
|
542
|
+
return {
|
|
543
|
+
newDocs: [],
|
|
544
|
+
nextCursor: makeCursor(seededPayload),
|
|
545
|
+
skippedOtherAuthor: 0,
|
|
546
|
+
skippedEmpty: 0,
|
|
547
|
+
skippedTooLarge: 0,
|
|
548
|
+
} as GitHubSyncResult;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
return await incrementalSync(fetchFn, config, payload, args.abortSignal);
|
|
552
|
+
},
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// ---------------------------------------------------------------------------
|
|
557
|
+
// First-sync: seed watermarks without importing
|
|
558
|
+
// ---------------------------------------------------------------------------
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* For each configured repo and resource type, query the current latest
|
|
562
|
+
* item timestamp and record it as the starting watermark. Returns without
|
|
563
|
+
* emitting any documents, mirroring Drive's `getStartPageToken` pattern.
|
|
564
|
+
*/
|
|
565
|
+
async function seedWatermarks(
|
|
566
|
+
fetchFn: GitHubFetchFn,
|
|
567
|
+
config: GitHubConnectorConfig,
|
|
568
|
+
initial: GitHubCursorPayload,
|
|
569
|
+
signal: AbortSignal | undefined,
|
|
570
|
+
): Promise<GitHubCursorPayload> {
|
|
571
|
+
const watermarks = { ...initial.watermarks };
|
|
572
|
+
// seenIds starts empty for first-sync; nothing has been processed yet.
|
|
573
|
+
|
|
574
|
+
for (const repo of config.repos) {
|
|
575
|
+
throwIfAborted(signal);
|
|
576
|
+
|
|
577
|
+
// Issue comments
|
|
578
|
+
try {
|
|
579
|
+
const latest = await fetchLatestTimestamp(
|
|
580
|
+
fetchFn,
|
|
581
|
+
config.token,
|
|
582
|
+
`${GITHUB_API_BASE}/repos/${repo}/issues/comments?sort=updated&direction=desc&per_page=1`,
|
|
583
|
+
"updated_at",
|
|
584
|
+
signal,
|
|
585
|
+
);
|
|
586
|
+
if (latest) watermarks[watermarkKey(repo, "issue-comment")] = latest;
|
|
587
|
+
} catch (err) {
|
|
588
|
+
if (isTransientGitHubError(err)) throw err;
|
|
589
|
+
// 404/403 → repo inaccessible, skip silently.
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
throwIfAborted(signal);
|
|
593
|
+
|
|
594
|
+
// PR review comments
|
|
595
|
+
try {
|
|
596
|
+
const latest = await fetchLatestTimestamp(
|
|
597
|
+
fetchFn,
|
|
598
|
+
config.token,
|
|
599
|
+
`${GITHUB_API_BASE}/repos/${repo}/pulls/comments?sort=updated&direction=desc&per_page=1`,
|
|
600
|
+
"updated_at",
|
|
601
|
+
signal,
|
|
602
|
+
);
|
|
603
|
+
if (latest) watermarks[watermarkKey(repo, "pr-review-comment")] = latest;
|
|
604
|
+
} catch (err) {
|
|
605
|
+
if (isTransientGitHubError(err)) throw err;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// Discussions (GraphQL not used; we use the REST search endpoint for simplicity)
|
|
609
|
+
if (config.includeDiscussions) {
|
|
610
|
+
throwIfAborted(signal);
|
|
611
|
+
try {
|
|
612
|
+
const latest = await fetchLatestTimestamp(
|
|
613
|
+
fetchFn,
|
|
614
|
+
config.token,
|
|
615
|
+
`${GITHUB_API_BASE}/repos/${repo}/discussions?sort=updated&direction=desc&per_page=1`,
|
|
616
|
+
"updated_at",
|
|
617
|
+
signal,
|
|
618
|
+
);
|
|
619
|
+
if (latest) watermarks[watermarkKey(repo, "discussion")] = latest;
|
|
620
|
+
} catch (err) {
|
|
621
|
+
if (isTransientGitHubError(err)) throw err;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
return { watermarks, seenIds: {} };
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Fetch the first page of a sorted list and return the `updated_at` field of
|
|
631
|
+
* the first item, or `undefined` if the list is empty.
|
|
632
|
+
*/
|
|
633
|
+
async function fetchLatestTimestamp(
|
|
634
|
+
fetchFn: GitHubFetchFn,
|
|
635
|
+
token: string,
|
|
636
|
+
url: string,
|
|
637
|
+
field: string,
|
|
638
|
+
signal: AbortSignal | undefined,
|
|
639
|
+
): Promise<string | undefined> {
|
|
640
|
+
const data = await githubGet(fetchFn, token, url, signal);
|
|
641
|
+
if (!Array.isArray(data) || data.length === 0) return undefined;
|
|
642
|
+
const first = data[0];
|
|
643
|
+
if (typeof first !== "object" || first === null) return undefined;
|
|
644
|
+
const ts = (first as Record<string, unknown>)[field];
|
|
645
|
+
return typeof ts === "string" && ts.length > 0 ? ts : undefined;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// ---------------------------------------------------------------------------
|
|
649
|
+
// Incremental sync
|
|
650
|
+
// ---------------------------------------------------------------------------
|
|
651
|
+
|
|
652
|
+
async function incrementalSync(
|
|
653
|
+
fetchFn: GitHubFetchFn,
|
|
654
|
+
config: GitHubConnectorConfig,
|
|
655
|
+
payload: GitHubCursorPayload,
|
|
656
|
+
signal: AbortSignal | undefined,
|
|
657
|
+
): Promise<GitHubSyncResult> {
|
|
658
|
+
const fetchedAt = new Date().toISOString();
|
|
659
|
+
const newDocs: ConnectorDocument[] = [];
|
|
660
|
+
const updatedWatermarks = { ...payload.watermarks };
|
|
661
|
+
let skippedOtherAuthor = 0;
|
|
662
|
+
let skippedEmpty = 0;
|
|
663
|
+
let skippedTooLarge = 0;
|
|
664
|
+
let totalConsumed = 0;
|
|
665
|
+
|
|
666
|
+
// P1 fix (same-timestamp dedup): carry seenIds forward from the cursor.
|
|
667
|
+
// Maps `{repo}/{kind}/{commentId}` → `updated_at` ISO string for all
|
|
668
|
+
// comments processed within the same second as their resource watermark.
|
|
669
|
+
// Cleared per-resource when the watermark advances into a new second.
|
|
670
|
+
const currentSeenIds: Record<string, string> = { ...payload.seenIds };
|
|
671
|
+
// Accumulate seenIds updates for each resource; merged into nextSeenIds below.
|
|
672
|
+
const updatedSeenIds: Record<string, string> = { ...payload.seenIds };
|
|
673
|
+
|
|
674
|
+
for (const repo of config.repos) {
|
|
675
|
+
if (totalConsumed >= MAX_ITEMS_PER_PASS) break;
|
|
676
|
+
throwIfAborted(signal);
|
|
677
|
+
|
|
678
|
+
// --- Issue comments ---
|
|
679
|
+
{
|
|
680
|
+
const wmKey = watermarkKey(repo, "issue-comment");
|
|
681
|
+
const since = payload.watermarks[wmKey];
|
|
682
|
+
try {
|
|
683
|
+
const result = await fetchAndFilterComments(
|
|
684
|
+
fetchFn,
|
|
685
|
+
config.token,
|
|
686
|
+
buildIssueCommentsUrl(repo, since),
|
|
687
|
+
repo,
|
|
688
|
+
"issue-comment",
|
|
689
|
+
config.userLogin,
|
|
690
|
+
since,
|
|
691
|
+
fetchedAt,
|
|
692
|
+
MAX_ITEMS_PER_PASS - totalConsumed,
|
|
693
|
+
currentSeenIds,
|
|
694
|
+
signal,
|
|
695
|
+
);
|
|
696
|
+
for (const doc of result.docs) newDocs.push(doc);
|
|
697
|
+
skippedOtherAuthor += result.skippedOtherAuthor;
|
|
698
|
+
skippedEmpty += result.skippedEmpty;
|
|
699
|
+
skippedTooLarge += result.skippedTooLarge;
|
|
700
|
+
totalConsumed += result.consumed;
|
|
701
|
+
if (result.latestWatermark) {
|
|
702
|
+
const prevWm = updatedWatermarks[wmKey];
|
|
703
|
+
const nextWm = result.latestWatermark;
|
|
704
|
+
updatedWatermarks[wmKey] = nextWm;
|
|
705
|
+
// Clear seenIds for this resource if the watermark crossed a second
|
|
706
|
+
// boundary; otherwise merge the newly-seen ids.
|
|
707
|
+
if (prevWm && watermarkCrossedSecond(prevWm, nextWm)) {
|
|
708
|
+
for (const k of Object.keys(updatedSeenIds)) {
|
|
709
|
+
if (k.startsWith(`${repo}/issue-comment/`)) delete updatedSeenIds[k];
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
for (const [k, v] of Object.entries(result.newSeenIds)) {
|
|
713
|
+
updatedSeenIds[k] = v;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
} catch (err) {
|
|
717
|
+
if (isTransientGitHubError(err)) throw err;
|
|
718
|
+
// Terminal (404/403): skip this resource for this repo.
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
if (totalConsumed >= MAX_ITEMS_PER_PASS) break;
|
|
723
|
+
throwIfAborted(signal);
|
|
724
|
+
|
|
725
|
+
// --- PR review comments ---
|
|
726
|
+
{
|
|
727
|
+
const wmKey = watermarkKey(repo, "pr-review-comment");
|
|
728
|
+
const since = payload.watermarks[wmKey];
|
|
729
|
+
try {
|
|
730
|
+
const result = await fetchAndFilterComments(
|
|
731
|
+
fetchFn,
|
|
732
|
+
config.token,
|
|
733
|
+
buildPrReviewCommentsUrl(repo, since),
|
|
734
|
+
repo,
|
|
735
|
+
"pr-review-comment",
|
|
736
|
+
config.userLogin,
|
|
737
|
+
since,
|
|
738
|
+
fetchedAt,
|
|
739
|
+
MAX_ITEMS_PER_PASS - totalConsumed,
|
|
740
|
+
currentSeenIds,
|
|
741
|
+
signal,
|
|
742
|
+
);
|
|
743
|
+
for (const doc of result.docs) newDocs.push(doc);
|
|
744
|
+
skippedOtherAuthor += result.skippedOtherAuthor;
|
|
745
|
+
skippedEmpty += result.skippedEmpty;
|
|
746
|
+
skippedTooLarge += result.skippedTooLarge;
|
|
747
|
+
totalConsumed += result.consumed;
|
|
748
|
+
if (result.latestWatermark) {
|
|
749
|
+
const prevWm = updatedWatermarks[wmKey];
|
|
750
|
+
const nextWm = result.latestWatermark;
|
|
751
|
+
updatedWatermarks[wmKey] = nextWm;
|
|
752
|
+
if (prevWm && watermarkCrossedSecond(prevWm, nextWm)) {
|
|
753
|
+
for (const k of Object.keys(updatedSeenIds)) {
|
|
754
|
+
if (k.startsWith(`${repo}/pr-review-comment/`)) delete updatedSeenIds[k];
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
for (const [k, v] of Object.entries(result.newSeenIds)) {
|
|
758
|
+
updatedSeenIds[k] = v;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
} catch (err) {
|
|
762
|
+
if (isTransientGitHubError(err)) throw err;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// --- Discussion comments (optional) ---
|
|
767
|
+
if (config.includeDiscussions && totalConsumed < MAX_ITEMS_PER_PASS) {
|
|
768
|
+
throwIfAborted(signal);
|
|
769
|
+
const wmKey = watermarkKey(repo, "discussion");
|
|
770
|
+
const since = payload.watermarks[wmKey];
|
|
771
|
+
try {
|
|
772
|
+
const result = await fetchAndFilterComments(
|
|
773
|
+
fetchFn,
|
|
774
|
+
config.token,
|
|
775
|
+
buildDiscussionsUrl(repo, since),
|
|
776
|
+
repo,
|
|
777
|
+
"discussion",
|
|
778
|
+
config.userLogin,
|
|
779
|
+
since,
|
|
780
|
+
fetchedAt,
|
|
781
|
+
MAX_ITEMS_PER_PASS - totalConsumed,
|
|
782
|
+
currentSeenIds,
|
|
783
|
+
signal,
|
|
784
|
+
);
|
|
785
|
+
for (const doc of result.docs) newDocs.push(doc);
|
|
786
|
+
skippedOtherAuthor += result.skippedOtherAuthor;
|
|
787
|
+
skippedEmpty += result.skippedEmpty;
|
|
788
|
+
skippedTooLarge += result.skippedTooLarge;
|
|
789
|
+
totalConsumed += result.consumed;
|
|
790
|
+
if (result.latestWatermark) {
|
|
791
|
+
const prevWm = updatedWatermarks[wmKey];
|
|
792
|
+
const nextWm = result.latestWatermark;
|
|
793
|
+
updatedWatermarks[wmKey] = nextWm;
|
|
794
|
+
if (prevWm && watermarkCrossedSecond(prevWm, nextWm)) {
|
|
795
|
+
for (const k of Object.keys(updatedSeenIds)) {
|
|
796
|
+
if (k.startsWith(`${repo}/discussion/`)) delete updatedSeenIds[k];
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
for (const [k, v] of Object.entries(result.newSeenIds)) {
|
|
800
|
+
updatedSeenIds[k] = v;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
} catch (err) {
|
|
804
|
+
if (isTransientGitHubError(err)) throw err;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
return {
|
|
810
|
+
newDocs,
|
|
811
|
+
nextCursor: makeCursor({ watermarks: updatedWatermarks, seenIds: updatedSeenIds }),
|
|
812
|
+
skippedOtherAuthor,
|
|
813
|
+
skippedEmpty,
|
|
814
|
+
skippedTooLarge,
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* Returns true when the new watermark has crossed into a new second relative
|
|
820
|
+
* to the previous watermark. ISO 8601 strings sort lexicographically and the
|
|
821
|
+
* second boundary is at the 19-character prefix (e.g. "2026-04-26T09:00:01").
|
|
822
|
+
*/
|
|
823
|
+
function watermarkCrossedSecond(prev: string, next: string): boolean {
|
|
824
|
+
return prev.slice(0, 19) < next.slice(0, 19);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
// ---------------------------------------------------------------------------
|
|
828
|
+
// URL builders
|
|
829
|
+
// ---------------------------------------------------------------------------
|
|
830
|
+
|
|
831
|
+
function buildIssueCommentsUrl(repo: string, since?: string): string {
|
|
832
|
+
const base = `${GITHUB_API_BASE}/repos/${repo}/issues/comments?sort=updated&direction=asc&per_page=${GITHUB_PAGE_SIZE}`;
|
|
833
|
+
return since ? `${base}&since=${encodeURIComponent(since)}` : base;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
function buildPrReviewCommentsUrl(repo: string, since?: string): string {
|
|
837
|
+
const base = `${GITHUB_API_BASE}/repos/${repo}/pulls/comments?sort=updated&direction=asc&per_page=${GITHUB_PAGE_SIZE}`;
|
|
838
|
+
return since ? `${base}&since=${encodeURIComponent(since)}` : base;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
function buildDiscussionsUrl(repo: string, since?: string): string {
|
|
842
|
+
// GitHub Discussions REST API (available for repos with discussions enabled).
|
|
843
|
+
// No server-side `since` filter exists, so we page and filter client-side.
|
|
844
|
+
const base = `${GITHUB_API_BASE}/repos/${repo}/discussions?sort=updated&direction=asc&per_page=${GITHUB_PAGE_SIZE}`;
|
|
845
|
+
return since ? `${base}&since=${encodeURIComponent(since)}` : base;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
// ---------------------------------------------------------------------------
|
|
849
|
+
// Comment fetching + filtering
|
|
850
|
+
// ---------------------------------------------------------------------------
|
|
851
|
+
|
|
852
|
+
interface FetchAndFilterResult {
|
|
853
|
+
docs: ConnectorDocument[];
|
|
854
|
+
skippedOtherAuthor: number;
|
|
855
|
+
skippedEmpty: number;
|
|
856
|
+
skippedTooLarge: number;
|
|
857
|
+
/** Count of items that were actually ingested (budget-counted). Skipped
|
|
858
|
+
* items (wrong author, empty body, too-large, seenIds dedup) do NOT
|
|
859
|
+
* consume budget — see P1 fix `PRRT_kwDORJXyws59sfBs`. */
|
|
860
|
+
consumed: number;
|
|
861
|
+
/** Latest `updated_at` we saw in this batch (includes skipped items so the
|
|
862
|
+
* watermark can advance past them). */
|
|
863
|
+
latestWatermark: string | undefined;
|
|
864
|
+
/**
|
|
865
|
+
* New seenId entries accumulated during this pass. Maps
|
|
866
|
+
* `{repo}/{kind}/{commentId}` → `updated_at` ISO string for every ingested
|
|
867
|
+
* comment. Used by the caller to build the next cursor's `seenIds` map
|
|
868
|
+
* (P1 fix `PRRT_kwDORJXyws59sfBq`).
|
|
869
|
+
*/
|
|
870
|
+
newSeenIds: Record<string, string>;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Page through the comments at `firstPageUrl`, filter to comments authored
|
|
875
|
+
* by `userLogin`, and build `ConnectorDocument` instances. Respects the
|
|
876
|
+
* per-pass cap via `remainingBudget`.
|
|
877
|
+
*
|
|
878
|
+
* Budget fix (P1 `PRRT_kwDORJXyws59sfBs`): only count ingested records
|
|
879
|
+
* against the budget. Items skipped for wrong author, empty/too-large body,
|
|
880
|
+
* or same-second seenId dedup do NOT advance the cap counter — they should
|
|
881
|
+
* not starve valid records.
|
|
882
|
+
*
|
|
883
|
+
* Same-timestamp dedup (P1 `PRRT_kwDORJXyws59sfBq`): `seenIds` carries
|
|
884
|
+
* comment ids already processed within the same second as the current
|
|
885
|
+
* watermark. If GitHub re-returns them because `since=` is inclusive and
|
|
886
|
+
* matches the exact watermark second, we skip them without re-importing.
|
|
887
|
+
*
|
|
888
|
+
* Uses `since` as a client-side lower-bound filter in addition to the
|
|
889
|
+
* server-side `?since=` param (the server may return items exactly at
|
|
890
|
+
* the watermark that we already ingested).
|
|
891
|
+
*/
|
|
892
|
+
async function fetchAndFilterComments(
|
|
893
|
+
fetchFn: GitHubFetchFn,
|
|
894
|
+
token: string,
|
|
895
|
+
firstPageUrl: string,
|
|
896
|
+
repo: string,
|
|
897
|
+
kind: string,
|
|
898
|
+
userLogin: string,
|
|
899
|
+
since: string | undefined,
|
|
900
|
+
fetchedAt: string,
|
|
901
|
+
remainingBudget: number,
|
|
902
|
+
seenIds: Record<string, string>,
|
|
903
|
+
signal: AbortSignal | undefined,
|
|
904
|
+
): Promise<FetchAndFilterResult> {
|
|
905
|
+
const docs: ConnectorDocument[] = [];
|
|
906
|
+
let skippedOtherAuthor = 0;
|
|
907
|
+
let skippedEmpty = 0;
|
|
908
|
+
let skippedTooLarge = 0;
|
|
909
|
+
let consumed = 0;
|
|
910
|
+
let latestWatermark: string | undefined = undefined;
|
|
911
|
+
const newSeenIds: Record<string, string> = {};
|
|
912
|
+
let nextUrl: string | undefined = firstPageUrl;
|
|
913
|
+
|
|
914
|
+
while (nextUrl && consumed < remainingBudget) {
|
|
915
|
+
throwIfAborted(signal);
|
|
916
|
+
|
|
917
|
+
const data = await githubGet(fetchFn, token, nextUrl, signal);
|
|
918
|
+
if (!Array.isArray(data)) break;
|
|
919
|
+
|
|
920
|
+
for (const item of data) {
|
|
921
|
+
if (consumed >= remainingBudget) break;
|
|
922
|
+
throwIfAborted(signal);
|
|
923
|
+
|
|
924
|
+
const comment = item as GitHubComment;
|
|
925
|
+
|
|
926
|
+
// Skip items strictly before the watermark. Items whose `updated_at`
|
|
927
|
+
// equals the watermark second must pass through so the seenIds check
|
|
928
|
+
// below can distinguish already-ingested comments from new ones at the
|
|
929
|
+
// same timestamp. Using `<` (strict) here is intentional — `<=` would
|
|
930
|
+
// make seenIds unreachable for boundary items, permanently dropping any
|
|
931
|
+
// comment that arrives in the same second as the current watermark.
|
|
932
|
+
if (since && comment.updated_at < since) {
|
|
933
|
+
continue;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// Same-second dedup: skip only if this exact (id, updated_at) pair was
|
|
937
|
+
// already ingested on a prior pass. A later edit of the same comment
|
|
938
|
+
// produces a newer `updated_at`, so we must NOT gate on id alone — we
|
|
939
|
+
// must also confirm the timestamp matches before skipping. This prevents
|
|
940
|
+
// silent data loss when a comment is edited after its first ingestion.
|
|
941
|
+
const seenKey = `${repo}/${kind}/${comment.id}`;
|
|
942
|
+
if (seenIds[seenKey] === comment.updated_at) {
|
|
943
|
+
continue;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// Author filter (client-side). Not counted against budget —
|
|
947
|
+
// P1 fix `PRRT_kwDORJXyws59sfBs`: only ingested records consume budget.
|
|
948
|
+
const authorLogin = comment.user?.login ?? null;
|
|
949
|
+
if (authorLogin !== userLogin) {
|
|
950
|
+
skippedOtherAuthor++;
|
|
951
|
+
// Still track watermark for non-matching items to prevent re-fetching
|
|
952
|
+
// them on every subsequent poll.
|
|
953
|
+
if (!latestWatermark || comment.updated_at > latestWatermark) {
|
|
954
|
+
latestWatermark = comment.updated_at;
|
|
955
|
+
}
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// Body validation. Also not counted against budget.
|
|
960
|
+
const body = comment.body ?? "";
|
|
961
|
+
const trimmed = body.trim();
|
|
962
|
+
if (trimmed.length === 0) {
|
|
963
|
+
skippedEmpty++;
|
|
964
|
+
if (!latestWatermark || comment.updated_at > latestWatermark) {
|
|
965
|
+
latestWatermark = comment.updated_at;
|
|
966
|
+
}
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
if (trimmed.length > MAX_BODY_BYTES) {
|
|
970
|
+
skippedTooLarge++;
|
|
971
|
+
if (!latestWatermark || comment.updated_at > latestWatermark) {
|
|
972
|
+
latestWatermark = comment.updated_at;
|
|
973
|
+
}
|
|
974
|
+
continue;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
// This item will be ingested — count it against the budget.
|
|
978
|
+
consumed++;
|
|
979
|
+
|
|
980
|
+
// Build document.
|
|
981
|
+
const doc = buildDocument(comment, repo, kind, fetchedAt);
|
|
982
|
+
docs.push(doc);
|
|
983
|
+
|
|
984
|
+
if (!latestWatermark || comment.updated_at > latestWatermark) {
|
|
985
|
+
latestWatermark = comment.updated_at;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
// Record in newSeenIds for same-second dedup on subsequent polls.
|
|
989
|
+
newSeenIds[seenKey] = comment.updated_at;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// Follow GitHub's `Link: <url>; rel="next"` header for pagination.
|
|
993
|
+
// We don't have direct header access via the minimal fetch abstraction,
|
|
994
|
+
// so pagination is signaled by a full page being returned. If the page
|
|
995
|
+
// has fewer items than GITHUB_PAGE_SIZE we've reached the end.
|
|
996
|
+
// This is conservative but correct — a short page always means "no more".
|
|
997
|
+
if (data.length < GITHUB_PAGE_SIZE) {
|
|
998
|
+
nextUrl = undefined;
|
|
999
|
+
} else {
|
|
1000
|
+
// Full page received — there may be more. Advance via page parameter.
|
|
1001
|
+
nextUrl = advancePageUrl(nextUrl);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
return { docs, skippedOtherAuthor, skippedEmpty, skippedTooLarge, consumed, latestWatermark, newSeenIds };
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Advance a paginated GitHub URL by incrementing the `page` query parameter.
|
|
1010
|
+
* GitHub uses 1-based page numbers; if no `page` param is present we assume
|
|
1011
|
+
* we're on page 1 and bump to page 2.
|
|
1012
|
+
*/
|
|
1013
|
+
function advancePageUrl(url: string): string {
|
|
1014
|
+
try {
|
|
1015
|
+
const u = new URL(url);
|
|
1016
|
+
const page = parseInt(u.searchParams.get("page") ?? "1", 10);
|
|
1017
|
+
u.searchParams.set("page", String(isNaN(page) ? 2 : page + 1));
|
|
1018
|
+
return u.toString();
|
|
1019
|
+
} catch {
|
|
1020
|
+
// If URL parsing fails, bail — don't loop infinitely.
|
|
1021
|
+
return "";
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
// ---------------------------------------------------------------------------
|
|
1026
|
+
// Document builder
|
|
1027
|
+
// ---------------------------------------------------------------------------
|
|
1028
|
+
|
|
1029
|
+
function buildDocument(
|
|
1030
|
+
comment: GitHubComment,
|
|
1031
|
+
repo: string,
|
|
1032
|
+
kind: string,
|
|
1033
|
+
fetchedAt: string,
|
|
1034
|
+
): ConnectorDocument {
|
|
1035
|
+
const externalId = `${repo}/${kind}/${comment.id}`;
|
|
1036
|
+
const externalUrl =
|
|
1037
|
+
typeof comment.html_url === "string" && comment.html_url.length > 0
|
|
1038
|
+
? comment.html_url
|
|
1039
|
+
: undefined;
|
|
1040
|
+
const title = buildTitle(repo, kind, comment);
|
|
1041
|
+
|
|
1042
|
+
return {
|
|
1043
|
+
id: externalId,
|
|
1044
|
+
title,
|
|
1045
|
+
content: (comment.body ?? "").trim(),
|
|
1046
|
+
source: {
|
|
1047
|
+
connector: GITHUB_CONNECTOR_ID,
|
|
1048
|
+
externalId,
|
|
1049
|
+
externalRevision: comment.updated_at,
|
|
1050
|
+
externalUrl,
|
|
1051
|
+
fetchedAt,
|
|
1052
|
+
},
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Build a short human-readable title for the comment document.
|
|
1058
|
+
* We avoid fetching the issue/PR title to keep the connector read-light.
|
|
1059
|
+
*/
|
|
1060
|
+
function buildTitle(repo: string, kind: string, comment: GitHubComment): string {
|
|
1061
|
+
const kindLabel =
|
|
1062
|
+
kind === "issue-comment"
|
|
1063
|
+
? "Issue comment"
|
|
1064
|
+
: kind === "pr-review-comment"
|
|
1065
|
+
? "PR review comment"
|
|
1066
|
+
: "Discussion comment";
|
|
1067
|
+
return `${kindLabel} in ${repo} (#${comment.id})`;
|
|
1068
|
+
}
|