@remnic/core 1.1.12 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-cli.d.ts +2 -1
- package/dist/access-cli.js +263 -82
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +26 -60
- package/dist/access-http.js +43 -29
- package/dist/access-mcp.d.ts +24 -6
- package/dist/access-mcp.js +35 -28
- package/dist/access-schema.d.ts +9 -6
- package/dist/access-schema.js +7 -5
- package/dist/access-service-DcCDmNYC.d.ts +1542 -0
- package/dist/access-service.d.ts +25 -7
- package/dist/access-service.js +33 -26
- package/dist/active-memory-bridge.js +2 -2
- package/dist/active-recall.js +11 -3
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/claude-code.d.ts +24 -0
- package/dist/adapters/claude-code.js +9 -0
- package/dist/adapters/codex.d.ts +25 -0
- package/dist/adapters/codex.js +9 -0
- package/dist/adapters/hermes.d.ts +35 -0
- package/dist/adapters/hermes.js +9 -0
- package/dist/adapters/index.d.ts +6 -0
- package/dist/adapters/index.js +26 -0
- package/dist/adapters/registry.d.ts +20 -0
- package/dist/adapters/registry.js +13 -0
- package/dist/adapters/replit.d.ts +28 -0
- package/dist/adapters/replit.js +9 -0
- package/dist/adapters/types.d.ts +43 -0
- package/dist/adapters/types.js +8 -0
- package/dist/bootstrap.d.ts +20 -5
- package/dist/boxes.d.ts +7 -0
- package/dist/boxes.js +1 -1
- package/dist/briefing.d.ts +5 -3
- package/dist/briefing.js +9 -6
- package/dist/buffer-surprise-report.js +1 -1
- package/dist/buffer.d.ts +18 -4
- package/dist/buffer.js +1 -1
- package/dist/calibration.js +4 -4
- package/dist/capsule-cli.d.ts +4 -4
- package/dist/capsule-cli.js +1 -1
- package/dist/capsule-crypto-5CYAGVC5.js +18 -0
- package/dist/capsule-merge-4MGKE7C5.js +189 -0
- package/dist/causal-behavior.d.ts +8 -28
- package/dist/causal-behavior.js +6 -3
- package/dist/causal-behavior.js.map +1 -1
- package/dist/causal-chain.js +3 -2
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +24 -13
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +3 -3
- package/dist/causal-trajectory.js +1 -1
- package/dist/chunk-25MQ7IHJ.js +427 -0
- package/dist/chunk-25MQ7IHJ.js.map +1 -0
- package/dist/chunk-2F2W355T.js +256 -0
- package/dist/chunk-2F2W355T.js.map +1 -0
- package/dist/chunk-2KI4QFHU.js +228 -0
- package/dist/chunk-2KI4QFHU.js.map +1 -0
- package/dist/chunk-2PRQG7PV.js +86 -0
- package/dist/chunk-2PRQG7PV.js.map +1 -0
- package/dist/chunk-2QR3XXIC.js +2272 -0
- package/dist/chunk-2QR3XXIC.js.map +1 -0
- package/dist/chunk-2WWLHTZY.js +121 -0
- package/dist/chunk-326G7DJK.js +2185 -0
- package/dist/chunk-326G7DJK.js.map +1 -0
- package/dist/chunk-34DQE4KF.js +174 -0
- package/dist/chunk-34DQE4KF.js.map +1 -0
- package/dist/chunk-3APJ5EVB.js +601 -0
- package/dist/chunk-3APJ5EVB.js.map +1 -0
- package/dist/chunk-3HPAPHUK.js +51 -0
- package/dist/chunk-3HPAPHUK.js.map +1 -0
- package/dist/chunk-3JXBXXM2.js +69 -0
- package/dist/chunk-3JXBXXM2.js.map +1 -0
- package/dist/chunk-3KW65B36.js +681 -0
- package/dist/chunk-3KW65B36.js.map +1 -0
- package/dist/chunk-3UXOZBHV.js +20 -0
- package/dist/chunk-3UXOZBHV.js.map +1 -0
- package/dist/chunk-3VAL7ZL2.js +266 -0
- package/dist/chunk-3VAL7ZL2.js.map +1 -0
- package/dist/chunk-3Y4P7RXM.js +31 -0
- package/dist/chunk-3Y4P7RXM.js.map +1 -0
- package/dist/chunk-47VWKCAF.js +273 -0
- package/dist/chunk-47VWKCAF.js.map +1 -0
- package/dist/chunk-4CRG46BG.js +271 -0
- package/dist/chunk-5375UYTQ.js +914 -0
- package/dist/chunk-5375UYTQ.js.map +1 -0
- package/dist/chunk-56K5QLHX.js +506 -0
- package/dist/chunk-56K5QLHX.js.map +1 -0
- package/dist/chunk-5RGLBDQF.js +596 -0
- package/dist/chunk-5RGLBDQF.js.map +1 -0
- package/dist/chunk-5UZXUTVO.js +9 -0
- package/dist/chunk-5UZXUTVO.js.map +1 -0
- package/dist/chunk-65PG43EQ.js +105 -0
- package/dist/chunk-65PG43EQ.js.map +1 -0
- package/dist/chunk-66DHUKLO.js +57 -0
- package/dist/chunk-66DHUKLO.js.map +1 -0
- package/dist/chunk-6FC5EGNV.js +46 -0
- package/dist/chunk-6FC5EGNV.js.map +1 -0
- package/dist/chunk-6H2TESSP.js +62 -0
- package/dist/chunk-6H2TESSP.js.map +1 -0
- package/dist/chunk-6LVVDPJ4.js +32 -0
- package/dist/chunk-6LVVDPJ4.js.map +1 -0
- package/dist/chunk-6RVI47ZR.js +159 -0
- package/dist/chunk-6RVI47ZR.js.map +1 -0
- package/dist/chunk-7AAT6G4Q.js +5117 -0
- package/dist/chunk-7AAT6G4Q.js.map +1 -0
- package/dist/chunk-7DTASS5T.js +29 -0
- package/dist/chunk-7DTASS5T.js.map +1 -0
- package/dist/chunk-7IASACLB.js +596 -0
- package/dist/chunk-7MNMYOFP.js +32 -0
- package/dist/chunk-7MNMYOFP.js.map +1 -0
- package/dist/chunk-7N4KAIGN.js +133 -0
- package/dist/chunk-7N4KAIGN.js.map +1 -0
- package/dist/chunk-7OZ53EXP.js +101 -0
- package/dist/chunk-7OZ53EXP.js.map +1 -0
- package/dist/chunk-7XYTQGCC.js +134 -0
- package/dist/chunk-7XYTQGCC.js.map +1 -0
- package/dist/chunk-A2XUIMJ3.js +341 -0
- package/dist/chunk-A2XUIMJ3.js.map +1 -0
- package/dist/chunk-AGZQD76C.js +201 -0
- package/dist/chunk-AGZQD76C.js.map +1 -0
- package/dist/chunk-APO3DCMU.js +361 -0
- package/dist/chunk-APO3DCMU.js.map +1 -0
- package/dist/chunk-BFBF3XEF.js +283 -0
- package/dist/chunk-BFBF3XEF.js.map +1 -0
- package/dist/chunk-BJ3KMYTB.js +1974 -0
- package/dist/chunk-BJ3KMYTB.js.map +1 -0
- package/dist/chunk-CHEL3SKB.js +6758 -0
- package/dist/chunk-CHEL3SKB.js.map +1 -0
- package/dist/chunk-CQZRLNMV.js +1491 -0
- package/dist/chunk-CQZRLNMV.js.map +1 -0
- package/dist/chunk-D46YSIYX.js +892 -0
- package/dist/chunk-D46YSIYX.js.map +1 -0
- package/dist/chunk-DINWEURR.js +648 -0
- package/dist/chunk-DINWEURR.js.map +1 -0
- package/dist/chunk-DK5LDEQM.js +530 -0
- package/dist/chunk-DK5LDEQM.js.map +1 -0
- package/dist/chunk-DOM4GKSW.js +34 -0
- package/dist/chunk-DOM4GKSW.js.map +1 -0
- package/dist/chunk-EDTHC6UD.js +1075 -0
- package/dist/chunk-EFJ3MQ4V.js +721 -0
- package/dist/chunk-EHRTFRWW.js +89 -0
- package/dist/chunk-EHRTFRWW.js.map +1 -0
- package/dist/chunk-FAJ7FZYM.js +11 -0
- package/dist/chunk-FAJ7FZYM.js.map +1 -0
- package/dist/chunk-FBYESMQ2.js +570 -0
- package/dist/chunk-FDU6HUUL.js +147 -0
- package/dist/chunk-FF4KLI5W.js +99 -0
- package/dist/chunk-FF4KLI5W.js.map +1 -0
- package/dist/chunk-FIT6DMX6.js +310 -0
- package/dist/chunk-FIT6DMX6.js.map +1 -0
- package/dist/chunk-FJ43PRLT.js +272 -0
- package/dist/chunk-FJ43PRLT.js.map +1 -0
- package/dist/chunk-FKFMOY3N.js +32 -0
- package/dist/chunk-FKFMOY3N.js.map +1 -0
- package/dist/chunk-FLTNHQK6.js +262 -0
- package/dist/chunk-FLTNHQK6.js.map +1 -0
- package/dist/chunk-GA454ALV.js +12436 -0
- package/dist/chunk-GA454ALV.js.map +1 -0
- package/dist/chunk-GGKRUQOO.js +228 -0
- package/dist/chunk-GIF42EW3.js +63 -0
- package/dist/chunk-GIF42EW3.js.map +1 -0
- package/dist/chunk-GL6I6MEQ.js +647 -0
- package/dist/chunk-H3ME6L6D.js +709 -0
- package/dist/chunk-H3ME6L6D.js.map +1 -0
- package/dist/chunk-HHLLAQGZ.js +1 -0
- package/dist/chunk-HXXBL2KD.js +2040 -0
- package/dist/chunk-I5V2VDIW.js +219 -0
- package/dist/chunk-I5V2VDIW.js.map +1 -0
- package/dist/chunk-I6K5FBRQ.js +35 -0
- package/dist/chunk-I6K5FBRQ.js.map +1 -0
- package/dist/chunk-ICRIXAP2.js +121 -0
- package/dist/chunk-ICRIXAP2.js.map +1 -0
- package/dist/chunk-J4EB7DNW.js +11 -0
- package/dist/chunk-J4EB7DNW.js.map +1 -0
- package/dist/chunk-JLFA7DQG.js +62 -0
- package/dist/chunk-JLFA7DQG.js.map +1 -0
- package/dist/chunk-KJTKLXTH.js +9 -0
- package/dist/chunk-KJTKLXTH.js.map +1 -0
- package/dist/chunk-KLAO5DGL.js +917 -0
- package/dist/chunk-KLAO5DGL.js.map +1 -0
- package/dist/chunk-KNKUID7G.js +183 -0
- package/dist/chunk-KOSORCJG.js +624 -0
- package/dist/chunk-KOSORCJG.js.map +1 -0
- package/dist/chunk-KUJVMMZQ.js +1262 -0
- package/dist/chunk-KUJVMMZQ.js.map +1 -0
- package/dist/chunk-LCR46JY5.js +123 -0
- package/dist/chunk-LCR46JY5.js.map +1 -0
- package/dist/chunk-LLQ2LLWF.js +148 -0
- package/dist/chunk-LLQ2LLWF.js.map +1 -0
- package/dist/chunk-LPMVBPA3.js +236 -0
- package/dist/chunk-LT3NLYSI.js +50 -0
- package/dist/chunk-LT3NLYSI.js.map +1 -0
- package/dist/chunk-LUDTDZLK.js +287 -0
- package/dist/chunk-LUDTDZLK.js.map +1 -0
- package/dist/chunk-M23FSH32.js +3963 -0
- package/dist/chunk-M23FSH32.js.map +1 -0
- package/dist/chunk-MC26UJIM.js +118 -0
- package/dist/chunk-ME6ESPZU.js +119 -0
- package/dist/chunk-ME6ESPZU.js.map +1 -0
- package/dist/chunk-MGKYQQYF.js +272 -0
- package/dist/chunk-MJFNCJXV.js +66 -0
- package/dist/chunk-MJFNCJXV.js.map +1 -0
- package/dist/chunk-MSWG7JI6.js +237 -0
- package/dist/chunk-MSWG7JI6.js.map +1 -0
- package/dist/chunk-MT25YHYH.js +141 -0
- package/dist/chunk-MT25YHYH.js.map +1 -0
- package/dist/chunk-MT4HVDUZ.js +53 -0
- package/dist/chunk-MY6TPVXW.js +219 -0
- package/dist/chunk-N2D6GXBM.js +267 -0
- package/dist/chunk-N2D6GXBM.js.map +1 -0
- package/dist/chunk-NJ3MJQZX.js +46 -0
- package/dist/chunk-NJ3MJQZX.js.map +1 -0
- package/dist/chunk-NMZY542O.js +335 -0
- package/dist/chunk-NMZY542O.js.map +1 -0
- package/dist/chunk-NNVTUXEB.js +23 -0
- package/dist/chunk-NZL6GGQE.js +375 -0
- package/dist/chunk-NZL6GGQE.js.map +1 -0
- package/dist/chunk-P4NEIHUT.js +108 -0
- package/dist/chunk-P7FMDTKL.js +103 -0
- package/dist/chunk-P7FMDTKL.js.map +1 -0
- package/dist/chunk-PHK3HARR.js +32 -0
- package/dist/chunk-PHK3HARR.js.map +1 -0
- package/dist/chunk-PIRJPV5T.js +98 -0
- package/dist/chunk-PIRJPV5T.js.map +1 -0
- package/dist/chunk-PK7H5L6Y.js +159 -0
- package/dist/chunk-PK7H5L6Y.js.map +1 -0
- package/dist/chunk-PR5FBTFU.js +233 -0
- package/dist/chunk-PR5FBTFU.js.map +1 -0
- package/dist/chunk-PU63GXWS.js +174 -0
- package/dist/chunk-PU63GXWS.js.map +1 -0
- package/dist/chunk-PZIAX57I.js +124 -0
- package/dist/chunk-PZIAX57I.js.map +1 -0
- package/dist/chunk-Q7P4WJDP.js +26 -0
- package/dist/chunk-Q7P4WJDP.js.map +1 -0
- package/dist/chunk-QQUAB63I.js +63 -0
- package/dist/chunk-QQUAB63I.js.map +1 -0
- package/dist/chunk-QRNI5JBH.js +18 -0
- package/dist/chunk-RHY3HH7P.js +601 -0
- package/dist/chunk-RHY3HH7P.js.map +1 -0
- package/dist/chunk-RRF5UOBJ.js +91 -0
- package/dist/chunk-RXDLTSWT.js +124 -0
- package/dist/chunk-RXDLTSWT.js.map +1 -0
- package/dist/chunk-RYED3SPJ.js +42 -0
- package/dist/chunk-RYED3SPJ.js.map +1 -0
- package/dist/chunk-S7KDBTWT.js +106 -0
- package/dist/chunk-S7KDBTWT.js.map +1 -0
- package/dist/chunk-SEDEKFYQ.js +1 -0
- package/dist/chunk-TECVW3JP.js +36 -0
- package/dist/chunk-TECVW3JP.js.map +1 -0
- package/dist/chunk-TFO23QT4.js +88 -0
- package/dist/chunk-TFO23QT4.js.map +1 -0
- package/dist/chunk-TK4UEOSK.js +76 -0
- package/dist/chunk-TK4UEOSK.js.map +1 -0
- package/dist/chunk-TKWGAOLV.js +122 -0
- package/dist/chunk-TKWGAOLV.js.map +1 -0
- package/dist/chunk-TMM4S4IJ.js +597 -0
- package/dist/chunk-TMM4S4IJ.js.map +1 -0
- package/dist/chunk-TMQLARTH.js +188 -0
- package/dist/chunk-TMQLARTH.js.map +1 -0
- package/dist/chunk-TPDBFYEG.js +130 -0
- package/dist/chunk-TPDBFYEG.js.map +1 -0
- package/dist/chunk-TPMQ3G6Z.js +145 -0
- package/dist/chunk-TPMQ3G6Z.js.map +1 -0
- package/dist/chunk-TZOLIGIG.js +61 -0
- package/dist/chunk-TZOLIGIG.js.map +1 -0
- package/dist/chunk-U3PN77QT.js +113 -0
- package/dist/chunk-U3WSW6PZ.js +277 -0
- package/dist/chunk-U4SCL7B7.js +640 -0
- package/dist/chunk-U4SCL7B7.js.map +1 -0
- package/dist/chunk-UWK5OXUJ.js +156 -0
- package/dist/chunk-UWK5OXUJ.js.map +1 -0
- package/dist/chunk-UWVJF25J.js +74 -0
- package/dist/chunk-UXHQAFNA.js +1317 -0
- package/dist/chunk-UXHQAFNA.js.map +1 -0
- package/dist/chunk-V5OCT34X.js +1 -0
- package/dist/chunk-VLXA6PI2.js +304 -0
- package/dist/chunk-VLXA6PI2.js.map +1 -0
- package/dist/chunk-VNO6ZJ35.js +500 -0
- package/dist/chunk-VNO6ZJ35.js.map +1 -0
- package/dist/chunk-VW676BEI.js +827 -0
- package/dist/chunk-VW676BEI.js.map +1 -0
- package/dist/chunk-W3LR522O.js +2296 -0
- package/dist/chunk-W4L6CZKA.js +96 -0
- package/dist/chunk-W4L6CZKA.js.map +1 -0
- package/dist/chunk-W4RVMTHR.js +372 -0
- package/dist/chunk-W4RVMTHR.js.map +1 -0
- package/dist/chunk-WEHSQBFR.js +188 -0
- package/dist/chunk-WEHSQBFR.js.map +1 -0
- package/dist/chunk-WELDCG6C.js +380 -0
- package/dist/chunk-WELDCG6C.js.map +1 -0
- package/dist/chunk-WZYKANL3.js +2800 -0
- package/dist/chunk-WZYKANL3.js.map +1 -0
- package/dist/chunk-XIG5PDM7.js +48 -0
- package/dist/chunk-XJNBEDFE.js +193 -0
- package/dist/chunk-XJNBEDFE.js.map +1 -0
- package/dist/chunk-XVVIG67A.js +291 -0
- package/dist/chunk-XVVIG67A.js.map +1 -0
- package/dist/chunk-XVZ7B3HG.js +135 -0
- package/dist/chunk-YBPYIAA5.js +73 -0
- package/dist/chunk-YBPYIAA5.js.map +1 -0
- package/dist/chunk-Z734BLO3.js +21 -0
- package/dist/chunk-Z734BLO3.js.map +1 -0
- package/dist/chunk-ZKSK55RC.js +269 -0
- package/dist/chunk-ZKSK55RC.js.map +1 -0
- package/dist/chunk-ZTFCYYEZ.js +69 -0
- package/dist/chunk-ZTFCYYEZ.js.map +1 -0
- package/dist/chunk-ZY2MNJR6.js +329 -0
- package/dist/chunk-ZY2MNJR6.js.map +1 -0
- package/dist/cli-D3VpkVwB.d.ts +1136 -0
- package/dist/cli.d.ts +39 -10
- package/dist/cli.js +108 -49
- package/dist/commitment-ledger.js +1 -1
- package/dist/compat/checks.d.ts +5 -0
- package/dist/compat/checks.js +11 -0
- package/dist/compat/checks.js.map +1 -0
- package/dist/compat/types.d.ts +30 -0
- package/dist/compat/types.js +1 -0
- package/dist/compat/types.js.map +1 -0
- package/dist/compounding/engine.d.ts +221 -0
- package/dist/compounding/engine.js +32 -0
- package/dist/compounding/engine.js.map +1 -0
- package/dist/compounding/preference-consolidator.d.ts +92 -0
- package/dist/compounding/preference-consolidator.js +553 -0
- package/dist/compounding/preference-consolidator.js.map +1 -0
- package/dist/config.d.ts +4 -2
- package/dist/config.js +9 -4
- package/dist/conflict-policy-DyJ2wd-h.d.ts +4 -0
- package/dist/connectors/codex-materialize-runner.d.ts +64 -0
- package/dist/connectors/codex-materialize-runner.js +33 -0
- package/dist/connectors/codex-materialize-runner.js.map +1 -0
- package/dist/connectors/codex-materialize.d.ts +195 -0
- package/dist/connectors/codex-materialize.js +38 -0
- package/dist/connectors/codex-materialize.js.map +1 -0
- package/dist/connectors/index.d.ts +444 -0
- package/dist/connectors/index.js +115 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/connectors-cli-CwbyjGR7.d.ts +257 -0
- package/dist/connectors-cli.d.ts +1 -1
- package/dist/consolidation-provenance-check.d.ts +3 -1
- package/dist/consolidation-undo.d.ts +3 -1
- package/dist/contradiction/index.d.ts +258 -0
- package/dist/contradiction/index.js +43 -0
- package/dist/contradiction/index.js.map +1 -0
- package/dist/contradiction-review-ATP4S6IC.js +30 -0
- package/dist/contradiction-review-ATP4S6IC.js.map +1 -0
- package/dist/contradiction-scan-5A4IDZV5.js +13 -0
- package/dist/contradiction-scan-5A4IDZV5.js.map +1 -0
- package/dist/conversation-index/backend.d.ts +97 -0
- package/dist/conversation-index/backend.js +13 -0
- package/dist/conversation-index/backend.js.map +1 -0
- package/dist/conversation-index/chunker.d.ts +16 -0
- package/dist/conversation-index/chunker.js +8 -0
- package/dist/conversation-index/chunker.js.map +1 -0
- package/dist/conversation-index/cleanup.d.ts +11 -0
- package/dist/conversation-index/cleanup.js +9 -0
- package/dist/conversation-index/cleanup.js.map +1 -0
- package/dist/conversation-index/faiss-adapter.d.ts +6 -0
- package/dist/conversation-index/faiss-adapter.js +16 -0
- package/dist/conversation-index/faiss-adapter.js.map +1 -0
- package/dist/conversation-index/indexer.d.ts +23 -0
- package/dist/conversation-index/indexer.js +15 -0
- package/dist/conversation-index/indexer.js.map +1 -0
- package/dist/conversation-index/search.d.ts +6 -0
- package/dist/conversation-index/search.js +11 -0
- package/dist/conversation-index/search.js.map +1 -0
- package/dist/embedding-fallback.js +2 -2
- package/dist/enrichment/index.d.ts +163 -0
- package/dist/enrichment/index.js +18 -0
- package/dist/enrichment/index.js.map +1 -0
- package/dist/entity-retrieval.d.ts +4 -2
- package/dist/entity-retrieval.js +8 -5
- package/dist/evals.js +1 -1
- package/dist/explicit-capture.d.ts +20 -5
- package/dist/explicit-capture.js +2 -2
- package/dist/extraction-judge-training.js +1 -1
- package/dist/extraction.js +8 -8
- package/dist/faiss-adapter-CzPghc4C.d.ts +70 -0
- package/dist/fallback-llm.d.ts +2 -0
- package/dist/fallback-llm.js +4 -4
- package/dist/graph-edge-decay-5DI5GUNL.js +207 -0
- package/dist/index.d.ts +66 -711
- package/dist/index.js +556 -2680
- package/dist/index.js.map +1 -1
- package/dist/lcm/archive.d.ts +89 -0
- package/dist/lcm/archive.js +12 -0
- package/dist/lcm/archive.js.map +1 -0
- package/dist/lcm/dag.d.ts +48 -0
- package/dist/lcm/dag.js +8 -0
- package/dist/lcm/dag.js.map +1 -0
- package/dist/lcm/engine.d.ts +116 -0
- package/dist/lcm/engine.js +20 -0
- package/dist/lcm/engine.js.map +1 -0
- package/dist/lcm/index.d.ts +12 -0
- package/dist/lcm/index.js +44 -0
- package/dist/lcm/index.js.map +1 -0
- package/dist/lcm/queue.d.ts +62 -0
- package/dist/lcm/queue.js +8 -0
- package/dist/lcm/queue.js.map +1 -0
- package/dist/lcm/recall.d.ts +20 -0
- package/dist/lcm/recall.js +8 -0
- package/dist/lcm/recall.js.map +1 -0
- package/dist/lcm/schema.d.ts +16 -0
- package/dist/lcm/schema.js +14 -0
- package/dist/lcm/schema.js.map +1 -0
- package/dist/lcm/summarizer.d.ts +38 -0
- package/dist/lcm/summarizer.js +12 -0
- package/dist/lcm/summarizer.js.map +1 -0
- package/dist/lcm/tools.d.ts +29 -0
- package/dist/lcm/tools.js +8 -0
- package/dist/lcm/tools.js.map +1 -0
- package/dist/live-connectors-runner.js +5 -5
- package/dist/local-llm.js +3 -3
- package/dist/maintenance/archive-observations.d.ts +18 -0
- package/dist/maintenance/archive-observations.js +8 -0
- package/dist/maintenance/archive-observations.js.map +1 -0
- package/dist/maintenance/backup-stamp.d.ts +3 -0
- package/dist/maintenance/backup-stamp.js +8 -0
- package/dist/maintenance/backup-stamp.js.map +1 -0
- package/dist/maintenance/memory-governance-cron.d.ts +85 -0
- package/dist/maintenance/memory-governance-cron.js +22 -0
- package/dist/maintenance/memory-governance-cron.js.map +1 -0
- package/dist/maintenance/memory-governance.d.ts +137 -0
- package/dist/maintenance/memory-governance.js +40 -0
- package/dist/maintenance/memory-governance.js.map +1 -0
- package/dist/maintenance/migrate-observations.d.ts +18 -0
- package/dist/maintenance/migrate-observations.js +9 -0
- package/dist/maintenance/migrate-observations.js.map +1 -0
- package/dist/maintenance/observation-ledger-utils.d.ts +10 -0
- package/dist/maintenance/observation-ledger-utils.js +10 -0
- package/dist/maintenance/observation-ledger-utils.js.map +1 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +15 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +28 -0
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js.map +1 -0
- package/dist/maintenance/rebuild-memory-projection.d.ts +77 -0
- package/dist/maintenance/rebuild-memory-projection.js +35 -0
- package/dist/maintenance/rebuild-memory-projection.js.map +1 -0
- package/dist/maintenance/rebuild-observations.d.ts +17 -0
- package/dist/maintenance/rebuild-observations.js +9 -0
- package/dist/maintenance/rebuild-observations.js.map +1 -0
- package/dist/mcp-memory-inspector-app.d.ts +24 -6
- package/dist/memory-projection-store.d.ts +108 -3
- package/dist/memory-projection-store.js +2 -1
- package/dist/memory-worth-outcomes.d.ts +4 -2
- package/dist/migrate/from-engram.d.ts +24 -0
- package/dist/migrate/from-engram.js +12 -0
- package/dist/migrate/from-engram.js.map +1 -0
- package/dist/namespaces/migrate.d.ts +50 -0
- package/dist/namespaces/migrate.js +50 -0
- package/dist/namespaces/migrate.js.map +1 -0
- package/dist/namespaces/principal.d.ts +17 -0
- package/dist/namespaces/principal.js +16 -0
- package/dist/namespaces/principal.js.map +1 -0
- package/dist/namespaces/search.d.ts +46 -0
- package/dist/namespaces/search.js +28 -0
- package/dist/namespaces/search.js.map +1 -0
- package/dist/namespaces/storage.d.ts +32 -0
- package/dist/namespaces/storage.js +28 -0
- package/dist/namespaces/storage.js.map +1 -0
- package/dist/network/tailscale.d.ts +41 -0
- package/dist/network/tailscale.js +9 -0
- package/dist/network/tailscale.js.map +1 -0
- package/dist/network/webdav.d.ts +39 -0
- package/dist/network/webdav.js +10 -0
- package/dist/network/webdav.js.map +1 -0
- package/dist/objective-state-writers.js +2 -2
- package/dist/operator-toolkit.d.ts +4 -2
- package/dist/operator-toolkit.js +32 -14
- package/dist/opik-exporter.js +2 -2
- package/dist/opik-exporter.js.map +1 -1
- package/dist/orchestrator-DuWl9Hwx.d.ts +1244 -0
- package/dist/orchestrator.d.ts +22 -7
- package/dist/orchestrator.js +79 -44
- package/dist/path-MR5JPYOP.js +9 -0
- package/dist/path-MR5JPYOP.js.map +1 -0
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +102 -3
- package/dist/qmd.js +23 -5
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.js +2 -2
- package/dist/replay/normalizers/chatgpt.d.ts +6 -0
- package/dist/replay/normalizers/chatgpt.js +11 -0
- package/dist/replay/normalizers/chatgpt.js.map +1 -0
- package/dist/replay/normalizers/claude.d.ts +6 -0
- package/dist/replay/normalizers/claude.js +11 -0
- package/dist/replay/normalizers/claude.js.map +1 -0
- package/dist/replay/normalizers/openclaw.d.ts +6 -0
- package/dist/replay/normalizers/openclaw.js +11 -0
- package/dist/replay/normalizers/openclaw.js.map +1 -0
- package/dist/replay/normalizers/shared.d.ts +16 -0
- package/dist/replay/normalizers/shared.js +14 -0
- package/dist/replay/normalizers/shared.js.map +1 -0
- package/dist/replay/runner.d.ts +35 -0
- package/dist/replay/runner.js +16 -0
- package/dist/replay/runner.js.map +1 -0
- package/dist/replay/types.d.ts +57 -0
- package/dist/replay/types.js +19 -0
- package/dist/replay/types.js.map +1 -0
- package/dist/resolution-B7FNQSSP.js +12 -0
- package/dist/resolution-B7FNQSSP.js.map +1 -0
- package/dist/resolve-provider-secret.js +2 -2
- package/dist/resume-bundles.js +8 -6
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/routing/engine.d.ts +35 -0
- package/dist/routing/engine.js +16 -0
- package/dist/routing/engine.js.map +1 -0
- package/dist/routing/store.d.ts +27 -0
- package/dist/routing/store.js +10 -0
- package/dist/routing/store.js.map +1 -0
- package/dist/runtime/better-sqlite.d.ts +8 -0
- package/dist/runtime/better-sqlite.js +10 -0
- package/dist/runtime/better-sqlite.js.map +1 -0
- package/dist/runtime/child-process.d.ts +32 -0
- package/dist/runtime/child-process.js +10 -0
- package/dist/runtime/child-process.js.map +1 -0
- package/dist/runtime/env.d.ts +5 -0
- package/dist/runtime/env.js +12 -0
- package/dist/runtime/env.js.map +1 -0
- package/dist/schemas.d.ts +22 -22
- package/dist/sdk-compat.js +1 -1
- package/dist/search/document-scanner.d.ts +22 -0
- package/dist/search/document-scanner.js +8 -0
- package/dist/search/document-scanner.js.map +1 -0
- package/dist/search/embed-helper.d.ts +35 -0
- package/dist/search/embed-helper.js +9 -0
- package/dist/search/embed-helper.js.map +1 -0
- package/dist/search/factory.d.ts +32 -0
- package/dist/search/factory.js +29 -0
- package/dist/search/factory.js.map +1 -0
- package/dist/search/index.d.ts +15 -0
- package/dist/search/index.js +50 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/lancedb-backend.d.ts +51 -0
- package/dist/search/lancedb-backend.js +10 -0
- package/dist/search/lancedb-backend.js.map +1 -0
- package/dist/search/meilisearch-backend.d.ts +48 -0
- package/dist/search/meilisearch-backend.js +10 -0
- package/dist/search/meilisearch-backend.js.map +1 -0
- package/dist/search/noop-backend.d.ts +26 -0
- package/dist/search/noop-backend.js +8 -0
- package/dist/search/noop-backend.js.map +1 -0
- package/dist/search/orama-backend.d.ts +53 -0
- package/dist/search/orama-backend.js +10 -0
- package/dist/search/orama-backend.js.map +1 -0
- package/dist/search/port.d.ts +61 -0
- package/dist/search/port.js +1 -0
- package/dist/search/port.js.map +1 -0
- package/dist/search/remote-backend.d.ts +39 -0
- package/dist/search/remote-backend.js +9 -0
- package/dist/search/remote-backend.js.map +1 -0
- package/dist/secure-store/index.d.ts +890 -0
- package/dist/secure-store/index.js +156 -0
- package/dist/secure-store/index.js.map +1 -0
- package/dist/semantic-VwGI14Ok.d.ts +69 -0
- package/dist/semantic-consolidation-4HkHWgeI.d.ts +180 -0
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +13 -6
- package/dist/semantic-rule-promotion.js +8 -5
- package/dist/semantic-rule-verifier.js +8 -5
- package/dist/shared-context/manager.d.ts +131 -0
- package/dist/shared-context/manager.js +15 -0
- package/dist/shared-context/manager.js.map +1 -0
- package/dist/skills-registry.js +13 -1
- package/dist/skills-registry.js.map +1 -1
- package/dist/state-store-VZU2IA53.js +16 -0
- package/dist/state-store-VZU2IA53.js.map +1 -0
- package/dist/storage-paths.d.ts +9 -0
- package/dist/storage-paths.js +20 -0
- package/dist/storage-paths.js.map +1 -0
- package/dist/storage.d.ts +3 -1
- package/dist/storage.js +7 -4
- package/dist/summarizer.d.ts +5 -0
- package/dist/summarizer.js +9 -8
- package/dist/summary-snapshot.js +2 -1
- package/dist/surfaces/dreams.d.ts +16 -0
- package/dist/surfaces/dreams.js +282 -0
- package/dist/surfaces/dreams.js.map +1 -0
- package/dist/surfaces/heartbeat.d.ts +17 -0
- package/dist/surfaces/heartbeat.js +265 -0
- package/dist/surfaces/heartbeat.js.map +1 -0
- package/dist/temporal-supersession.d.ts +3 -1
- package/dist/threading.d.ts +5 -0
- package/dist/threading.js +2 -1
- package/dist/tier-migration.d.ts +4 -2
- package/dist/tokens.js +2 -2
- package/dist/transcript.d.ts +15 -1
- package/dist/transcript.js +2 -1
- package/dist/transfer/autodetect.d.ts +4 -0
- package/dist/transfer/autodetect.js +15 -0
- package/dist/transfer/autodetect.js.map +1 -0
- package/dist/transfer/backup.d.ts +21 -0
- package/dist/transfer/backup.js +17 -0
- package/dist/transfer/backup.js.map +1 -0
- package/dist/transfer/capsule-export.d.ts +113 -0
- package/dist/transfer/capsule-export.js +19 -0
- package/dist/transfer/capsule-export.js.map +1 -0
- package/dist/transfer/capsule-import.d.ts +124 -0
- package/dist/transfer/capsule-import.js +16 -0
- package/dist/transfer/capsule-import.js.map +1 -0
- package/dist/transfer/constants.d.ts +13 -0
- package/dist/transfer/constants.js +12 -0
- package/dist/transfer/constants.js.map +1 -0
- package/dist/transfer/export-json.d.ts +11 -0
- package/dist/transfer/export-json.js +11 -0
- package/dist/transfer/export-json.js.map +1 -0
- package/dist/transfer/export-md.d.ts +10 -0
- package/dist/transfer/export-md.js +13 -0
- package/dist/transfer/export-md.js.map +1 -0
- package/dist/transfer/export-sqlite.d.ts +9 -0
- package/dist/transfer/export-sqlite.js +12 -0
- package/dist/transfer/export-sqlite.js.map +1 -0
- package/dist/transfer/fs-utils.d.ts +61 -0
- package/dist/transfer/fs-utils.js +40 -0
- package/dist/transfer/fs-utils.js.map +1 -0
- package/dist/transfer/import-json.d.ts +16 -0
- package/dist/transfer/import-json.js +13 -0
- package/dist/transfer/import-json.js.map +1 -0
- package/dist/transfer/import-md.d.ts +14 -0
- package/dist/transfer/import-md.js +11 -0
- package/dist/transfer/import-md.js.map +1 -0
- package/dist/transfer/import-sqlite.d.ts +14 -0
- package/dist/transfer/import-sqlite.js +12 -0
- package/dist/transfer/import-sqlite.js.map +1 -0
- package/dist/transfer/sqlite-schema.d.ts +4 -0
- package/dist/transfer/sqlite-schema.js +10 -0
- package/dist/transfer/sqlite-schema.js.map +1 -0
- package/dist/transfer/types.d.ts +916 -0
- package/dist/transfer/types.js +30 -0
- package/dist/transfer/types.js.map +1 -0
- package/dist/types.d.ts +28 -1
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +9 -6
- package/dist/work/board.d.ts +43 -0
- package/dist/work/board.js +14 -0
- package/dist/work/board.js.map +1 -0
- package/dist/work/boundary.d.ts +8 -0
- package/dist/work/boundary.js +14 -0
- package/dist/work/boundary.js.map +1 -0
- package/dist/work/storage.d.ts +39 -0
- package/dist/work/storage.js +11 -0
- package/dist/work/storage.js.map +1 -0
- package/dist/work/types.d.ts +75 -0
- package/dist/work/types.js +1 -0
- package/dist/work/types.js.map +1 -0
- package/package.json +2767 -6
- package/scripts/faiss_index.py +816 -0
- package/scripts/faiss_requirements.txt +3 -0
- package/skills/remnic-entities/SKILL.md +51 -0
- package/skills/remnic-memory-workflow/SKILL.md +61 -0
- package/skills/remnic-recall/SKILL.md +51 -0
- package/skills/remnic-remember/SKILL.md +56 -0
- package/skills/remnic-search/SKILL.md +51 -0
- package/skills/remnic-status/SKILL.md +51 -0
- package/src/abort-error.test.ts +49 -0
- package/src/abort-error.ts +46 -0
- package/src/abstraction-nodes.ts +162 -0
- package/src/access-audit.test.ts +178 -0
- package/src/access-audit.ts +125 -0
- package/src/access-cli.test.ts +439 -0
- package/src/access-cli.ts +438 -0
- package/src/access-http.test.ts +225 -0
- package/src/access-http.ts +1899 -0
- package/src/access-idempotency.ts +232 -0
- package/src/access-mcp.test.ts +568 -0
- package/src/access-mcp.ts +3056 -0
- package/src/access-schema-pi.test.ts +60 -0
- package/src/access-schema.ts +522 -0
- package/src/access-service-namespace.test.ts +123 -0
- package/src/access-service.ts +5629 -0
- package/src/action-confidence.test.ts +206 -0
- package/src/action-confidence.ts +466 -0
- package/src/active-memory-bridge.test.ts +285 -0
- package/src/active-memory-bridge.ts +217 -0
- package/src/active-recall.test.ts +484 -0
- package/src/active-recall.ts +459 -0
- package/src/adapters/claude-code.ts +56 -0
- package/src/adapters/codex.ts +57 -0
- package/src/adapters/hermes.ts +64 -0
- package/src/adapters/index.ts +6 -0
- package/src/adapters/registry.ts +41 -0
- package/src/adapters/replit.ts +55 -0
- package/src/adapters/types.ts +51 -0
- package/src/behavior-learner.ts +144 -0
- package/src/behavior-signals.ts +73 -0
- package/src/binary-lifecycle/backend.ts +117 -0
- package/src/binary-lifecycle/index.ts +35 -0
- package/src/binary-lifecycle/manifest.ts +79 -0
- package/src/binary-lifecycle/pipeline.ts +352 -0
- package/src/binary-lifecycle/scanner.ts +89 -0
- package/src/binary-lifecycle/types.ts +89 -0
- package/src/bootstrap.ts +178 -0
- package/src/boxes.ts +521 -0
- package/src/briefing.test.ts +1535 -0
- package/src/briefing.ts +1382 -0
- package/src/buffer-session.test.ts +443 -0
- package/src/buffer-surprise-report.ts +176 -0
- package/src/buffer-surprise-telemetry.test.ts +606 -0
- package/src/buffer-surprise-trigger.test.ts +766 -0
- package/src/buffer-surprise.test.ts +339 -0
- package/src/buffer-surprise.ts +203 -0
- package/src/buffer.ts +900 -0
- package/src/bulk-import/cli-command.test.ts +204 -0
- package/src/bulk-import/index.ts +34 -0
- package/src/bulk-import/pipeline.test.ts +445 -0
- package/src/bulk-import/pipeline.ts +178 -0
- package/src/bulk-import/registry.test.ts +151 -0
- package/src/bulk-import/registry.ts +72 -0
- package/src/bulk-import/types.test.ts +272 -0
- package/src/bulk-import/types.ts +145 -0
- package/src/calibration.ts +394 -0
- package/src/capsule-cli.test.ts +398 -0
- package/src/capsule-cli.ts +565 -0
- package/src/causal-behavior.ts +308 -0
- package/src/causal-chain.ts +419 -0
- package/src/causal-consolidation.ts +370 -0
- package/src/causal-retrieval.ts +286 -0
- package/src/causal-trajectory-graph.ts +60 -0
- package/src/causal-trajectory.ts +303 -0
- package/src/chunking.ts +220 -0
- package/src/citations.ts +232 -0
- package/src/cli.ts +9403 -0
- package/src/codex-cli-fallback.ts +162 -0
- package/src/codex-thread-key.ts +1 -0
- package/src/coding/access-coding-context.test.ts +197 -0
- package/src/coding/coding-branch-scope.test.ts +281 -0
- package/src/coding/coding-namespace.test.ts +360 -0
- package/src/coding/coding-namespace.ts +412 -0
- package/src/coding/coding-orchestrator.test.ts +249 -0
- package/src/coding/git-context.test.ts +507 -0
- package/src/coding/git-context.ts +336 -0
- package/src/coding/mcp-set-coding-context.test.ts +174 -0
- package/src/coding/review-context.test.ts +316 -0
- package/src/coding/review-context.ts +349 -0
- package/src/coding/wire-coding-context.test.ts +468 -0
- package/src/commitment-ledger.test.ts +78 -0
- package/src/commitment-ledger.ts +337 -0
- package/src/compat/checks.test.ts +206 -0
- package/src/compat/checks.ts +716 -0
- package/src/compat/types.ts +33 -0
- package/src/compounding/engine.ts +1686 -0
- package/src/compounding/preference-consolidator.ts +778 -0
- package/src/compression-optimizer.ts +312 -0
- package/src/config.test.ts +930 -0
- package/src/config.ts +3807 -0
- package/src/connectors/codex/instructions.md +160 -0
- package/src/connectors/codex/resources/namespace-cheatsheet.md +48 -0
- package/src/connectors/codex-marketplace.ts +500 -0
- package/src/connectors/codex-materialize-runner.ts +212 -0
- package/src/connectors/codex-materialize.ts +983 -0
- package/src/connectors/coerce.ts +62 -0
- package/src/connectors/index.test.ts +1570 -0
- package/src/connectors/index.ts +3222 -0
- package/src/connectors/live/framework.ts +164 -0
- package/src/connectors/live/github.test.ts +1218 -0
- package/src/connectors/live/github.ts +1068 -0
- package/src/connectors/live/gmail.test.ts +1706 -0
- package/src/connectors/live/gmail.ts +1293 -0
- package/src/connectors/live/google-drive.test.ts +696 -0
- package/src/connectors/live/google-drive.ts +724 -0
- package/src/connectors/live/index.ts +101 -0
- package/src/connectors/live/live-connectors.test.ts +689 -0
- package/src/connectors/live/notion.test.ts +1109 -0
- package/src/connectors/live/notion.ts +978 -0
- package/src/connectors/live/registry.ts +103 -0
- package/src/connectors/live/state-store.ts +399 -0
- package/src/connectors/live/transient-errors.ts +150 -0
- package/src/connectors/weclone-installer.test.ts +850 -0
- package/src/connectors-cli.ts +513 -0
- package/src/console/state.test.ts +224 -0
- package/src/console/state.ts +514 -0
- package/src/console/trace.test.ts +813 -0
- package/src/console/trace.ts +603 -0
- package/src/console/tui.test.ts +582 -0
- package/src/console/tui.ts +508 -0
- package/src/consolidation-operator.ts +182 -0
- package/src/consolidation-provenance-check.ts +551 -0
- package/src/consolidation-undo.ts +718 -0
- package/src/contradiction/contradiction-judge.test.ts +189 -0
- package/src/contradiction/contradiction-judge.ts +333 -0
- package/src/contradiction/contradiction-review.ts +574 -0
- package/src/contradiction/contradiction-scan.ts +504 -0
- package/src/contradiction/contradiction.test.ts +2230 -0
- package/src/contradiction/index.ts +37 -0
- package/src/contradiction/resolution.ts +383 -0
- package/src/conversation-index/backend.ts +323 -0
- package/src/conversation-index/chunker.ts +47 -0
- package/src/conversation-index/cleanup.ts +53 -0
- package/src/conversation-index/faiss-adapter.ts +384 -0
- package/src/conversation-index/indexer.test.ts +164 -0
- package/src/conversation-index/indexer.ts +192 -0
- package/src/conversation-index/search.ts +37 -0
- package/src/cross-namespace-budget.test.ts +275 -0
- package/src/cross-namespace-budget.ts +365 -0
- package/src/cue-anchors.ts +163 -0
- package/src/curation/index.ts +544 -0
- package/src/dashboard-runtime.ts +337 -0
- package/src/day-summary.ts +122 -0
- package/src/dedup/index.ts +330 -0
- package/src/dedup/semantic.test.ts +1577 -0
- package/src/dedup/semantic.ts +148 -0
- package/src/delinearize.ts +193 -0
- package/src/direct-answer-wiring.test.ts +473 -0
- package/src/direct-answer-wiring.ts +180 -0
- package/src/direct-answer.test.ts +484 -0
- package/src/direct-answer.ts +273 -0
- package/src/embedding-fallback.ts +565 -0
- package/src/enrichment/audit.ts +89 -0
- package/src/enrichment/index.ts +27 -0
- package/src/enrichment/pipeline.ts +197 -0
- package/src/enrichment/provider-registry.ts +85 -0
- package/src/enrichment/types.ts +100 -0
- package/src/enrichment/web-search-provider.ts +63 -0
- package/src/entity-retrieval.ts +774 -0
- package/src/entity-schema.ts +239 -0
- package/src/evals.ts +1312 -0
- package/src/event-order-recall.test.ts +4164 -0
- package/src/event-order-recall.ts +2802 -0
- package/src/evidence-pack.test.ts +89 -0
- package/src/evidence-pack.ts +388 -0
- package/src/explicit-capture.ts +530 -0
- package/src/explicit-cue-recall.test.ts +3019 -0
- package/src/explicit-cue-recall.ts +5545 -0
- package/src/extraction-judge-telemetry.ts +234 -0
- package/src/extraction-judge-training.ts +221 -0
- package/src/extraction-judge.ts +846 -0
- package/src/extraction-timeout.test.ts +265 -0
- package/src/extraction.ts +2719 -0
- package/src/fallback-llm.test.ts +1060 -0
- package/src/fallback-llm.ts +918 -0
- package/src/focused-list-recall.test.ts +734 -0
- package/src/focused-list-recall.ts +1160 -0
- package/src/graph-dashboard-diff.ts +35 -0
- package/src/graph-dashboard-key.ts +5 -0
- package/src/graph-dashboard-parser.ts +104 -0
- package/src/graph-edge-reinforcement.ts +192 -0
- package/src/graph-events.ts +151 -0
- package/src/graph-recall.test.ts +164 -0
- package/src/graph-recall.ts +189 -0
- package/src/graph-retrieval.test.ts +809 -0
- package/src/graph-retrieval.ts +823 -0
- package/src/graph-snapshot.ts +329 -0
- package/src/graph.ts +813 -0
- package/src/harmonic-retrieval.ts +223 -0
- package/src/himem.ts +154 -0
- package/src/hygiene.ts +87 -0
- package/src/identity-continuity.ts +333 -0
- package/src/importance.ts +328 -0
- package/src/importers/base.test.ts +294 -0
- package/src/importers/base.ts +436 -0
- package/src/importers/index.ts +21 -0
- package/src/index.ts +1204 -0
- package/src/intent.ts +154 -0
- package/src/json-extract.ts +85 -0
- package/src/json-store.ts +42 -0
- package/src/lcm/archive.ts +617 -0
- package/src/lcm/dag.ts +199 -0
- package/src/lcm/engine.ts +645 -0
- package/src/lcm/index.ts +7 -0
- package/src/lcm/queue.test.ts +178 -0
- package/src/lcm/queue.ts +200 -0
- package/src/lcm/recall.ts +117 -0
- package/src/lcm/schema.ts +154 -0
- package/src/lcm/summarizer.ts +235 -0
- package/src/lcm/tools.ts +191 -0
- package/src/lcm-engine.test.ts +660 -0
- package/src/legacy-hook-compat.test.ts +20 -0
- package/src/legacy-hook-compat.ts +45 -0
- package/src/lifecycle.ts +289 -0
- package/src/live-connectors-runner.ts +385 -0
- package/src/local-llm-qos.test.ts +303 -0
- package/src/local-llm-thinking.test.ts +292 -0
- package/src/local-llm.ts +1464 -0
- package/src/logger.ts +49 -0
- package/src/maintenance/archive-observations.ts +147 -0
- package/src/maintenance/backup-stamp.ts +3 -0
- package/src/maintenance/dreams-ledger.ts +516 -0
- package/src/maintenance/first-start-migration.ts +362 -0
- package/src/maintenance/forget.test.ts +206 -0
- package/src/maintenance/forget.ts +126 -0
- package/src/maintenance/graph-edge-decay.test.ts +409 -0
- package/src/maintenance/graph-edge-decay.ts +394 -0
- package/src/maintenance/memory-governance-cron.ts +447 -0
- package/src/maintenance/memory-governance.ts +1039 -0
- package/src/maintenance/migrate-observations.ts +216 -0
- package/src/maintenance/observation-ledger-utils.ts +54 -0
- package/src/maintenance/pattern-reinforcement.test.ts +875 -0
- package/src/maintenance/pattern-reinforcement.ts +369 -0
- package/src/maintenance/purge.ts +334 -0
- package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +78 -0
- package/src/maintenance/rebuild-memory-projection.ts +1234 -0
- package/src/maintenance/rebuild-observations.ts +178 -0
- package/src/maintenance/tier-stats.test.ts +378 -0
- package/src/maintenance/tier-stats.ts +222 -0
- package/src/mcp-memory-inspector-app.ts +421 -0
- package/src/memory-action-policy.ts +80 -0
- package/src/memory-cache.ts +208 -0
- package/src/memory-extension/claude-code-publisher.ts +51 -0
- package/src/memory-extension/codex-publisher.ts +149 -0
- package/src/memory-extension/hermes-publisher.ts +51 -0
- package/src/memory-extension/index.ts +100 -0
- package/src/memory-extension/shared-instructions.ts +133 -0
- package/src/memory-extension/types.ts +86 -0
- package/src/memory-extension-host/host-discovery.ts +276 -0
- package/src/memory-extension-host/index.ts +14 -0
- package/src/memory-extension-host/render-extensions-block.ts +73 -0
- package/src/memory-extension-host/types.ts +21 -0
- package/src/memory-lifecycle-ledger-utils.ts +116 -0
- package/src/memory-projection-format.ts +11 -0
- package/src/memory-projection-store.ts +951 -0
- package/src/memory-provenance.test.ts +196 -0
- package/src/memory-provenance.ts +484 -0
- package/src/memory-worth-bench.test.ts +71 -0
- package/src/memory-worth-bench.ts +265 -0
- package/src/memory-worth-filter.test.ts +209 -0
- package/src/memory-worth-filter.ts +204 -0
- package/src/memory-worth-frontmatter.test.ts +311 -0
- package/src/memory-worth-outcomes.test.ts +316 -0
- package/src/memory-worth-outcomes.ts +286 -0
- package/src/memory-worth.test.ts +317 -0
- package/src/memory-worth.ts +215 -0
- package/src/message-parts/index.ts +806 -0
- package/src/message-parts/message-parts.test.ts +421 -0
- package/src/migrate/from-engram.ts +789 -0
- package/src/model-registry.ts +313 -0
- package/src/models-json.ts +76 -0
- package/src/namespaces/migrate.ts +187 -0
- package/src/namespaces/path.ts +25 -0
- package/src/namespaces/principal.test.ts +195 -0
- package/src/namespaces/principal.ts +86 -0
- package/src/namespaces/search.test.ts +105 -0
- package/src/namespaces/search.ts +233 -0
- package/src/namespaces/storage.ts +74 -0
- package/src/native-knowledge.ts +1823 -0
- package/src/negative.ts +72 -0
- package/src/network/tailscale.ts +179 -0
- package/src/network/webdav.ts +385 -0
- package/src/objective-state-writers.ts +951 -0
- package/src/objective-state.ts +320 -0
- package/src/onboarding/index.ts +529 -0
- package/src/openai-chat-compat.ts +56 -0
- package/src/operator-toolkit.ts +2132 -0
- package/src/opik-exporter.test.ts +72 -0
- package/src/opik-exporter.ts +587 -0
- package/src/orchestrator-extraction-queue.test.ts +197 -0
- package/src/orchestrator-flush.test.ts +1171 -0
- package/src/orchestrator-pattern-reinforcement.test.ts +128 -0
- package/src/orchestrator-source-attribution.test.ts +701 -0
- package/src/orchestrator.ts +16368 -0
- package/src/page-versioning.ts +450 -0
- package/src/patterns-cli.ts +574 -0
- package/src/peers/index.ts +54 -0
- package/src/peers/migrate-from-identity-anchor.test.ts +291 -0
- package/src/peers/migrate-from-identity-anchor.ts +350 -0
- package/src/peers/peers.test.ts +419 -0
- package/src/peers/profile-reasoner.ts +694 -0
- package/src/peers/storage.ts +1350 -0
- package/src/peers/types.ts +138 -0
- package/src/plugin-id.ts +84 -0
- package/src/policy-runtime.ts +209 -0
- package/src/procedural/procedure-miner.ts +150 -0
- package/src/procedural/procedure-recall.ts +93 -0
- package/src/procedural/procedure-stats.ts +213 -0
- package/src/procedural/procedure-types.ts +132 -0
- package/src/procedural/reinforcement-core.test.ts +132 -0
- package/src/procedural/reinforcement-core.ts +73 -0
- package/src/profiling.test.ts +263 -0
- package/src/profiling.ts +435 -0
- package/src/projection/index.ts +398 -0
- package/src/qmd-recall-cache.test.ts +138 -0
- package/src/qmd-recall-cache.ts +111 -0
- package/src/qmd.test.ts +257 -0
- package/src/qmd.ts +2614 -0
- package/src/reasoning-trace-recall.ts +201 -0
- package/src/reasoning-trace-types.ts +235 -0
- package/src/recall-audit-anomaly.test.ts +246 -0
- package/src/recall-audit-anomaly.ts +297 -0
- package/src/recall-audit.test.ts +51 -0
- package/src/recall-audit.ts +72 -0
- package/src/recall-budget-config.test.ts +87 -0
- package/src/recall-disclosure-escalation.test.ts +196 -0
- package/src/recall-disclosure-escalation.ts +158 -0
- package/src/recall-disclosure-shaping.test.ts +146 -0
- package/src/recall-disclosure.test.ts +214 -0
- package/src/recall-explain-renderer.test.ts +140 -0
- package/src/recall-explain-renderer.ts +356 -0
- package/src/recall-mmr.test.ts +808 -0
- package/src/recall-mmr.ts +607 -0
- package/src/recall-qos.test.ts +85 -0
- package/src/recall-qos.ts +82 -0
- package/src/recall-query-policy.ts +221 -0
- package/src/recall-state.test.ts +233 -0
- package/src/recall-state.ts +456 -0
- package/src/recall-tag-filter.ts +143 -0
- package/src/recall-tokenization.ts +35 -0
- package/src/recall-xray-cli.test.ts +118 -0
- package/src/recall-xray-cli.ts +100 -0
- package/src/recall-xray-disclosure-telemetry.test.ts +183 -0
- package/src/recall-xray-renderer.test.ts +539 -0
- package/src/recall-xray-renderer.ts +487 -0
- package/src/recall-xray.test.ts +503 -0
- package/src/recall-xray.ts +621 -0
- package/src/reconstruct.ts +41 -0
- package/src/release-changelog.ts +35 -0
- package/src/relevance.ts +67 -0
- package/src/replay/normalizers/chatgpt.ts +133 -0
- package/src/replay/normalizers/claude.ts +102 -0
- package/src/replay/normalizers/openclaw.ts +119 -0
- package/src/replay/normalizers/shared.ts +69 -0
- package/src/replay/runner.ts +197 -0
- package/src/replay/types.ts +143 -0
- package/src/rerank.test.ts +48 -0
- package/src/rerank.ts +176 -0
- package/src/resolve-auth-token.test.ts +226 -0
- package/src/resolve-auth-token.ts +151 -0
- package/src/resolve-provider-secret.test.ts +187 -0
- package/src/resolve-provider-secret.ts +410 -0
- package/src/response-guidance-recall.test.ts +3952 -0
- package/src/response-guidance-recall.ts +4431 -0
- package/src/resume-bundles.ts +415 -0
- package/src/retrieval-agents.ts +623 -0
- package/src/retrieval-tiers.ts +25 -0
- package/src/retrieval.ts +104 -0
- package/src/review/index.test.ts +201 -0
- package/src/review/index.ts +536 -0
- package/src/routing/engine.ts +162 -0
- package/src/routing/store.ts +321 -0
- package/src/runtime/better-sqlite.test.ts +32 -0
- package/src/runtime/better-sqlite.ts +76 -0
- package/src/runtime/child-process.ts +67 -0
- package/src/runtime/env.ts +48 -0
- package/src/sanitize.ts +58 -0
- package/src/schemas.ts +449 -0
- package/src/sdk-compat.ts +87 -0
- package/src/search/document-scanner.ts +96 -0
- package/src/search/embed-helper.ts +142 -0
- package/src/search/factory.ts +189 -0
- package/src/search/index.ts +10 -0
- package/src/search/lancedb-backend.ts +342 -0
- package/src/search/meilisearch-backend.ts +232 -0
- package/src/search/noop-backend.ts +57 -0
- package/src/search/orama-backend.ts +358 -0
- package/src/search/port.ts +86 -0
- package/src/search/remote-backend.ts +124 -0
- package/src/secure-store/cipher.ts +271 -0
- package/src/secure-store/cli-handlers.ts +355 -0
- package/src/secure-store/cli-renderer.ts +131 -0
- package/src/secure-store/header.ts +373 -0
- package/src/secure-store/index.ts +137 -0
- package/src/secure-store/kdf.ts +263 -0
- package/src/secure-store/keyring.ts +106 -0
- package/src/secure-store/metadata.ts +394 -0
- package/src/secure-store/passphrase-reader.ts +252 -0
- package/src/secure-store/secure-fs.ts +571 -0
- package/src/secure-store/secure-store.test.ts +755 -0
- package/src/semantic-chunking.ts +545 -0
- package/src/semantic-consolidation.test.ts +182 -0
- package/src/semantic-consolidation.ts +432 -0
- package/src/semantic-rule-promotion.ts +183 -0
- package/src/semantic-rule-verifier.ts +160 -0
- package/src/session-integrity.ts +569 -0
- package/src/session-observer-bands.ts +11 -0
- package/src/session-observer-state.ts +346 -0
- package/src/session-toggles.test.ts +96 -0
- package/src/session-toggles.ts +159 -0
- package/src/shared-context/manager.ts +810 -0
- package/src/signal.ts +84 -0
- package/src/skills-registry.test.ts +277 -0
- package/src/skills-registry.ts +120 -0
- package/src/source-attribution-roundtrip.test.ts +215 -0
- package/src/source-attribution.test.ts +1425 -0
- package/src/source-attribution.ts +639 -0
- package/src/spaces/index.ts +627 -0
- package/src/storage-paths.ts +117 -0
- package/src/storage.ts +6657 -0
- package/src/store-contract.ts +55 -0
- package/src/summarizer.ts +844 -0
- package/src/summary-snapshot.test.ts +681 -0
- package/src/summary-snapshot.ts +238 -0
- package/src/surfaces/dreams.test.ts +394 -0
- package/src/surfaces/dreams.ts +346 -0
- package/src/surfaces/heartbeat.test.ts +415 -0
- package/src/surfaces/heartbeat.ts +325 -0
- package/src/sync/index.ts +308 -0
- package/src/targeted-fact-recall.test.ts +1694 -0
- package/src/targeted-fact-recall.ts +2905 -0
- package/src/taxonomy/default-taxonomy.ts +87 -0
- package/src/taxonomy/index.ts +26 -0
- package/src/taxonomy/resolver-doc-generator.ts +57 -0
- package/src/taxonomy/resolver.ts +184 -0
- package/src/taxonomy/taxonomy-loader.ts +186 -0
- package/src/taxonomy/types.ts +48 -0
- package/src/telemetry-transcript.ts +70 -0
- package/src/temporal-index.ts +890 -0
- package/src/temporal-supersession.test.ts +2703 -0
- package/src/temporal-supersession.ts +493 -0
- package/src/temporal-validity.test.ts +448 -0
- package/src/temporal-validity.ts +123 -0
- package/src/threading.ts +395 -0
- package/src/tier-migration.ts +124 -0
- package/src/tier-routing.ts +102 -0
- package/src/tmt.ts +462 -0
- package/src/tokens.test.ts +178 -0
- package/src/tokens.ts +279 -0
- package/src/topics.ts +147 -0
- package/src/training-export/cli-date-validation.test.ts +258 -0
- package/src/training-export/converter.test.ts +452 -0
- package/src/training-export/converter.ts +319 -0
- package/src/training-export/date-parse.ts +117 -0
- package/src/training-export/index.ts +26 -0
- package/src/training-export/registry.test.ts +85 -0
- package/src/training-export/registry.ts +57 -0
- package/src/training-export/types.ts +31 -0
- package/src/transcript.ts +1179 -0
- package/src/transfer/autodetect.ts +30 -0
- package/src/transfer/backup.ts +138 -0
- package/src/transfer/capsule-crypto.ts +485 -0
- package/src/transfer/capsule-encrypt.test.ts +690 -0
- package/src/transfer/capsule-export.ts +543 -0
- package/src/transfer/capsule-fork.ts +375 -0
- package/src/transfer/capsule-import.ts +564 -0
- package/src/transfer/capsule-merge.ts +433 -0
- package/src/transfer/conflict-policy.ts +16 -0
- package/src/transfer/constants.ts +13 -0
- package/src/transfer/exclusions.ts +37 -0
- package/src/transfer/export-json.ts +65 -0
- package/src/transfer/export-md.ts +59 -0
- package/src/transfer/export-sqlite.ts +52 -0
- package/src/transfer/fs-utils.ts +269 -0
- package/src/transfer/import-json.ts +108 -0
- package/src/transfer/import-md.ts +84 -0
- package/src/transfer/import-sqlite.ts +100 -0
- package/src/transfer/integrity.ts +71 -0
- package/src/transfer/sqlite-schema.ts +16 -0
- package/src/transfer/types.ts +297 -0
- package/src/trust-zones.ts +1186 -0
- package/src/types.ts +3074 -0
- package/src/user-model.test.ts +124 -0
- package/src/user-model.ts +162 -0
- package/src/utility-learner.ts +353 -0
- package/src/utility-runtime.ts +88 -0
- package/src/utility-telemetry.ts +215 -0
- package/src/utils/category-dir.ts +44 -0
- package/src/utils/errno.ts +6 -0
- package/src/utils/iso-timestamp.test.ts +37 -0
- package/src/utils/iso-timestamp.ts +164 -0
- package/src/utils/path.ts +26 -0
- package/src/verified-recall.ts +138 -0
- package/src/version-utils.test.ts +10 -0
- package/src/version-utils.ts +9 -0
- package/src/whitespace.ts +10 -0
- package/src/work/board.ts +359 -0
- package/src/work/boundary.ts +107 -0
- package/src/work/storage.ts +436 -0
- package/src/work/types.ts +82 -0
- package/src/work-product-ledger.ts +265 -0
- package/dist/access-service-DDjzFALq.d.ts +0 -2088
- package/dist/capsule-crypto-SJS5VVAP.js +0 -18
- package/dist/capsule-export-7QNCBZOQ.js +0 -17
- package/dist/capsule-import-EPBHD2EN.js +0 -16
- package/dist/capsule-merge-DI7PNQ2H.js +0 -189
- package/dist/chunk-23ZZK64Y.js +0 -26
- package/dist/chunk-23ZZK64Y.js.map +0 -1
- package/dist/chunk-242S3I2A.js +0 -647
- package/dist/chunk-2LGMW3DJ.js +0 -111
- package/dist/chunk-3B6KIRBH.js +0 -5213
- package/dist/chunk-3B6KIRBH.js.map +0 -1
- package/dist/chunk-457A4P3L.js +0 -119
- package/dist/chunk-457A4P3L.js.map +0 -1
- package/dist/chunk-4IS4SXIQ.js +0 -2040
- package/dist/chunk-4YM32CRU.js +0 -721
- package/dist/chunk-6TBWYBJ3.js +0 -236
- package/dist/chunk-74EMIVE4.js +0 -329
- package/dist/chunk-74EMIVE4.js.map +0 -1
- package/dist/chunk-767ODGE6.js +0 -183
- package/dist/chunk-7V22HTMD.js +0 -623
- package/dist/chunk-7V22HTMD.js.map +0 -1
- package/dist/chunk-7ZM3BFKK.js +0 -9705
- package/dist/chunk-7ZM3BFKK.js.map +0 -1
- package/dist/chunk-AQJNPMOA.js +0 -643
- package/dist/chunk-AQJNPMOA.js.map +0 -1
- package/dist/chunk-ASAITVLA.js +0 -64
- package/dist/chunk-ASAITVLA.js.map +0 -1
- package/dist/chunk-BBE34QBJ.js +0 -275
- package/dist/chunk-BBE34QBJ.js.map +0 -1
- package/dist/chunk-BZSQEPRW.js +0 -14710
- package/dist/chunk-BZSQEPRW.js.map +0 -1
- package/dist/chunk-CPKTBRS2.js +0 -891
- package/dist/chunk-CPKTBRS2.js.map +0 -1
- package/dist/chunk-D4GAOFF6.js +0 -562
- package/dist/chunk-D4GAOFF6.js.map +0 -1
- package/dist/chunk-D54LZC5L.js +0 -147
- package/dist/chunk-DF3RVK3X.js +0 -119
- package/dist/chunk-DF3RVK3X.js.map +0 -1
- package/dist/chunk-DZZPC36E.js +0 -1451
- package/dist/chunk-DZZPC36E.js.map +0 -1
- package/dist/chunk-E2UCDP5S.js +0 -570
- package/dist/chunk-E6K4NIEU.js +0 -747
- package/dist/chunk-E6K4NIEU.js.map +0 -1
- package/dist/chunk-EEQLFRUM.js +0 -89
- package/dist/chunk-ETOW6ACV.js +0 -158
- package/dist/chunk-ETOW6ACV.js.map +0 -1
- package/dist/chunk-FMEBPEAO.js +0 -347
- package/dist/chunk-FMEBPEAO.js.map +0 -1
- package/dist/chunk-FQDPCE3I.js +0 -1837
- package/dist/chunk-FQDPCE3I.js.map +0 -1
- package/dist/chunk-FYIYMQ5N.js +0 -221
- package/dist/chunk-FYIYMQ5N.js.map +0 -1
- package/dist/chunk-G2WADRQ3.js +0 -219
- package/dist/chunk-G4SK7DSQ.js +0 -121
- package/dist/chunk-GVPWB7EY.js +0 -390
- package/dist/chunk-GVPWB7EY.js.map +0 -1
- package/dist/chunk-HELQZFZO.js +0 -1075
- package/dist/chunk-HL5LRPNA.js +0 -1914
- package/dist/chunk-HL5LRPNA.js.map +0 -1
- package/dist/chunk-HQZVVSVB.js +0 -147
- package/dist/chunk-HQZVVSVB.js.map +0 -1
- package/dist/chunk-HY3L4WKC.js +0 -2195
- package/dist/chunk-HY3L4WKC.js.map +0 -1
- package/dist/chunk-IB3BFHGN.js +0 -228
- package/dist/chunk-IXEJRKCZ.js +0 -18
- package/dist/chunk-JBMSGZEQ.js +0 -441
- package/dist/chunk-JBMSGZEQ.js.map +0 -1
- package/dist/chunk-JESOB2HO.js +0 -108
- package/dist/chunk-JKDVIE52.js +0 -272
- package/dist/chunk-JRNQ3RNA.js +0 -284
- package/dist/chunk-JRNQ3RNA.js.map +0 -1
- package/dist/chunk-K6WK37A6.js +0 -865
- package/dist/chunk-K6WK37A6.js.map +0 -1
- package/dist/chunk-MARWOCVP.js +0 -48
- package/dist/chunk-MNU6ZBWT.js +0 -4454
- package/dist/chunk-MNU6ZBWT.js.map +0 -1
- package/dist/chunk-N5AKDXAI.js +0 -74
- package/dist/chunk-OA3L7BFR.js +0 -183
- package/dist/chunk-OA3L7BFR.js.map +0 -1
- package/dist/chunk-OR64ZGRZ.js +0 -23
- package/dist/chunk-P77UEOU2.js +0 -1521
- package/dist/chunk-P77UEOU2.js.map +0 -1
- package/dist/chunk-PH4C2U43.js +0 -239
- package/dist/chunk-PH4C2U43.js.map +0 -1
- package/dist/chunk-RVPLBATS.js +0 -1586
- package/dist/chunk-RVPLBATS.js.map +0 -1
- package/dist/chunk-U5JMRGKX.js +0 -340
- package/dist/chunk-U5JMRGKX.js.map +0 -1
- package/dist/chunk-URB2WSKZ.js +0 -350
- package/dist/chunk-URB2WSKZ.js.map +0 -1
- package/dist/chunk-UVMUAWVT.js +0 -596
- package/dist/chunk-WEJG4TB5.js +0 -118
- package/dist/chunk-X7HPGUVG.js +0 -271
- package/dist/chunk-XAMBKFQS.js +0 -2777
- package/dist/chunk-XAMBKFQS.js.map +0 -1
- package/dist/chunk-XJKFSSDW.js +0 -726
- package/dist/chunk-XJKFSSDW.js.map +0 -1
- package/dist/chunk-XMHBH5H6.js +0 -283
- package/dist/chunk-XMHBH5H6.js.map +0 -1
- package/dist/chunk-XMVFHBHT.js +0 -277
- package/dist/chunk-Y3VMVTYX.js +0 -53
- package/dist/chunk-YNB73F22.js +0 -137
- package/dist/chunk-YNB73F22.js.map +0 -1
- package/dist/chunk-Z2E7VW55.js +0 -335
- package/dist/chunk-Z2E7VW55.js.map +0 -1
- package/dist/chunk-ZG7PTKBK.js +0 -2296
- package/dist/chunk-ZNQN6ZTA.js +0 -135
- package/dist/chunk-ZVTKDVVM.js +0 -827
- package/dist/chunk-ZVTKDVVM.js.map +0 -1
- package/dist/cli-BR8KpIU0.d.ts +0 -1259
- package/dist/codex-materialize-CQlLTzke.d.ts +0 -139
- package/dist/connectors-cli-DFGtY2DB.d.ts +0 -257
- package/dist/contradiction-review-5LTTVDQV.js +0 -22
- package/dist/contradiction-scan-QTXAMBUA.js +0 -414
- package/dist/contradiction-scan-QTXAMBUA.js.map +0 -1
- package/dist/engine-35M5BKQ7.js +0 -28
- package/dist/fs-utils-IRVUFB6G.js +0 -30
- package/dist/graph-edge-decay-PWB63GRE.js +0 -207
- package/dist/memory-governance-IMPQZXFC.js +0 -37
- package/dist/memory-projection-store-CY8TU40w.d.ts +0 -222
- package/dist/orchestrator-DDMPqU6R.d.ts +0 -1792
- package/dist/path-RMTY5Y5A.js +0 -9
- package/dist/port-B6VEDIkC.d.ts +0 -53
- package/dist/resolution-YGIBORXI.js +0 -101
- package/dist/resolution-YGIBORXI.js.map +0 -1
- package/dist/secure-store-4R2GSO7S.js +0 -156
- package/dist/semantic-consolidation-ByBXb-sf.d.ts +0 -180
- package/dist/state-store-3EH7HYIN.js +0 -16
- package/dist/types-V3FJ26TF.js +0 -30
- /package/dist/{capsule-crypto-SJS5VVAP.js.map → adapters/claude-code.js.map} +0 -0
- /package/dist/{capsule-export-7QNCBZOQ.js.map → adapters/codex.js.map} +0 -0
- /package/dist/{capsule-import-EPBHD2EN.js.map → adapters/hermes.js.map} +0 -0
- /package/dist/{contradiction-review-5LTTVDQV.js.map → adapters/index.js.map} +0 -0
- /package/dist/{engine-35M5BKQ7.js.map → adapters/registry.js.map} +0 -0
- /package/dist/{fs-utils-IRVUFB6G.js.map → adapters/replit.js.map} +0 -0
- /package/dist/{memory-governance-IMPQZXFC.js.map → adapters/types.js.map} +0 -0
- /package/dist/{path-RMTY5Y5A.js.map → capsule-crypto-5CYAGVC5.js.map} +0 -0
- /package/dist/{capsule-merge-DI7PNQ2H.js.map → capsule-merge-4MGKE7C5.js.map} +0 -0
- /package/dist/{chunk-G4SK7DSQ.js.map → chunk-2WWLHTZY.js.map} +0 -0
- /package/dist/{chunk-X7HPGUVG.js.map → chunk-4CRG46BG.js.map} +0 -0
- /package/dist/{chunk-UVMUAWVT.js.map → chunk-7IASACLB.js.map} +0 -0
- /package/dist/{chunk-HELQZFZO.js.map → chunk-EDTHC6UD.js.map} +0 -0
- /package/dist/{chunk-4YM32CRU.js.map → chunk-EFJ3MQ4V.js.map} +0 -0
- /package/dist/{chunk-E2UCDP5S.js.map → chunk-FBYESMQ2.js.map} +0 -0
- /package/dist/{chunk-D54LZC5L.js.map → chunk-FDU6HUUL.js.map} +0 -0
- /package/dist/{chunk-IB3BFHGN.js.map → chunk-GGKRUQOO.js.map} +0 -0
- /package/dist/{chunk-242S3I2A.js.map → chunk-GL6I6MEQ.js.map} +0 -0
- /package/dist/{secure-store-4R2GSO7S.js.map → chunk-HHLLAQGZ.js.map} +0 -0
- /package/dist/{chunk-4IS4SXIQ.js.map → chunk-HXXBL2KD.js.map} +0 -0
- /package/dist/{chunk-767ODGE6.js.map → chunk-KNKUID7G.js.map} +0 -0
- /package/dist/{chunk-6TBWYBJ3.js.map → chunk-LPMVBPA3.js.map} +0 -0
- /package/dist/{chunk-WEJG4TB5.js.map → chunk-MC26UJIM.js.map} +0 -0
- /package/dist/{chunk-JKDVIE52.js.map → chunk-MGKYQQYF.js.map} +0 -0
- /package/dist/{chunk-Y3VMVTYX.js.map → chunk-MT4HVDUZ.js.map} +0 -0
- /package/dist/{chunk-G2WADRQ3.js.map → chunk-MY6TPVXW.js.map} +0 -0
- /package/dist/{chunk-OR64ZGRZ.js.map → chunk-NNVTUXEB.js.map} +0 -0
- /package/dist/{chunk-JESOB2HO.js.map → chunk-P4NEIHUT.js.map} +0 -0
- /package/dist/{chunk-IXEJRKCZ.js.map → chunk-QRNI5JBH.js.map} +0 -0
- /package/dist/{chunk-EEQLFRUM.js.map → chunk-RRF5UOBJ.js.map} +0 -0
- /package/dist/{state-store-3EH7HYIN.js.map → chunk-SEDEKFYQ.js.map} +0 -0
- /package/dist/{chunk-2LGMW3DJ.js.map → chunk-U3PN77QT.js.map} +0 -0
- /package/dist/{chunk-XMVFHBHT.js.map → chunk-U3WSW6PZ.js.map} +0 -0
- /package/dist/{chunk-N5AKDXAI.js.map → chunk-UWVJF25J.js.map} +0 -0
- /package/dist/{types-V3FJ26TF.js.map → chunk-V5OCT34X.js.map} +0 -0
- /package/dist/{chunk-ZG7PTKBK.js.map → chunk-W3LR522O.js.map} +0 -0
- /package/dist/{chunk-MARWOCVP.js.map → chunk-XIG5PDM7.js.map} +0 -0
- /package/dist/{chunk-ZNQN6ZTA.js.map → chunk-XVZ7B3HG.js.map} +0 -0
- /package/dist/{graph-edge-decay-PWB63GRE.js.map → graph-edge-decay-5DI5GUNL.js.map} +0 -0
|
@@ -0,0 +1,914 @@
|
|
|
1
|
+
import {
|
|
2
|
+
encodeStoragePathSegment,
|
|
3
|
+
encodeStoragePathSegmentWithHash,
|
|
4
|
+
isSafeLegacyPathSegment,
|
|
5
|
+
resolveSafeStoragePath,
|
|
6
|
+
storagePathHash
|
|
7
|
+
} from "./chunk-FF4KLI5W.js";
|
|
8
|
+
import {
|
|
9
|
+
analyzeSessionIntegrity
|
|
10
|
+
} from "./chunk-YRMVARQP.js";
|
|
11
|
+
import {
|
|
12
|
+
log
|
|
13
|
+
} from "./chunk-2ODBA7MQ.js";
|
|
14
|
+
|
|
15
|
+
// src/transcript.ts
|
|
16
|
+
import { appendFile, mkdir, readdir, readFile, stat, unlink, writeFile } from "fs/promises";
|
|
17
|
+
import path from "path";
|
|
18
|
+
function legacyTranscriptDirFor(channelType, channelId, encodedDir) {
|
|
19
|
+
if (!isSafeLegacyPathSegment(channelType) || !isSafeLegacyPathSegment(channelId)) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
const legacyDir = path.join(channelType, channelId);
|
|
23
|
+
return legacyDir === encodedDir ? void 0 : legacyDir;
|
|
24
|
+
}
|
|
25
|
+
var TranscriptManager = class _TranscriptManager {
|
|
26
|
+
transcriptsDir;
|
|
27
|
+
checkpointPath;
|
|
28
|
+
stateDir;
|
|
29
|
+
toolUsageDir;
|
|
30
|
+
config;
|
|
31
|
+
sessionFootprintCache = /* @__PURE__ */ new Map();
|
|
32
|
+
directoryOwnershipCache = /* @__PURE__ */ new Map();
|
|
33
|
+
/** Default checkpoint TTL in hours */
|
|
34
|
+
static DEFAULT_CHECKPOINT_TTL_HOURS = 24;
|
|
35
|
+
/** Approximate characters per token for rough estimation */
|
|
36
|
+
static CHARS_PER_TOKEN = 4;
|
|
37
|
+
constructor(config) {
|
|
38
|
+
this.config = config;
|
|
39
|
+
this.transcriptsDir = path.join(config.memoryDir, "transcripts");
|
|
40
|
+
this.stateDir = path.join(config.memoryDir, "state");
|
|
41
|
+
this.checkpointPath = path.join(this.stateDir, "checkpoint.json");
|
|
42
|
+
this.toolUsageDir = path.join(this.stateDir, "tool-usage");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse a sessionKey to extract channel type and ID.
|
|
46
|
+
*
|
|
47
|
+
* SessionKey patterns:
|
|
48
|
+
* - agent:<agent-id>:main → type="main", id="default"
|
|
49
|
+
* - agent:<agent-id>:discord:channel:<channel-id> → type="discord", id="<channel-id>"
|
|
50
|
+
* - agent:<agent-id>:cron:<job-id> → type="cron", id="<job-id>"
|
|
51
|
+
* - agent:<agent-id>:slack:channel:<channel-id> → type="slack", id="<channel-id>"
|
|
52
|
+
*
|
|
53
|
+
* @returns Object with raw channel identifiers and encoded storage path pieces.
|
|
54
|
+
*/
|
|
55
|
+
getTranscriptPath(sessionKey) {
|
|
56
|
+
const parts = sessionKey.split(":");
|
|
57
|
+
let channelType = "other";
|
|
58
|
+
let channelId = "default";
|
|
59
|
+
if (parts.length >= 3) {
|
|
60
|
+
channelType = parts[2];
|
|
61
|
+
if (channelType === "main") {
|
|
62
|
+
channelId = "default";
|
|
63
|
+
} else if (channelType === "discord" && parts.length >= 5 && parts[3] === "channel") {
|
|
64
|
+
channelId = parts[4];
|
|
65
|
+
} else if (channelType === "slack" && parts.length >= 5 && parts[3] === "channel") {
|
|
66
|
+
channelId = parts[4];
|
|
67
|
+
} else if (channelType === "cron" && parts.length >= 4) {
|
|
68
|
+
channelId = parts[3];
|
|
69
|
+
} else if (parts.length >= 4) {
|
|
70
|
+
channelId = parts[3];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
74
|
+
const dir = path.join(
|
|
75
|
+
encodeStoragePathSegment(channelType),
|
|
76
|
+
encodeStoragePathSegment(channelId)
|
|
77
|
+
);
|
|
78
|
+
const alternateDir = path.join(
|
|
79
|
+
encodeStoragePathSegmentWithHash(channelType),
|
|
80
|
+
`${encodeStoragePathSegmentWithHash(channelId)}--session-${storagePathHash(sessionKey)}`
|
|
81
|
+
);
|
|
82
|
+
return {
|
|
83
|
+
dir,
|
|
84
|
+
file: `${today}.jsonl`,
|
|
85
|
+
channelType,
|
|
86
|
+
channelId,
|
|
87
|
+
alternateDir,
|
|
88
|
+
legacyDir: legacyTranscriptDirFor(channelType, channelId, dir)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Initialize the transcript manager by ensuring directories exist.
|
|
93
|
+
*/
|
|
94
|
+
async initialize() {
|
|
95
|
+
await mkdir(this.transcriptsDir, { recursive: true });
|
|
96
|
+
await mkdir(this.stateDir, { recursive: true });
|
|
97
|
+
await mkdir(this.toolUsageDir, { recursive: true });
|
|
98
|
+
log.info("transcript manager initialized");
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Best-effort list of sessionKeys that have transcript files on disk.
|
|
102
|
+
* This is used by cron-style tooling (hourly summaries, conversation indexing)
|
|
103
|
+
* to iterate across "active" sessions.
|
|
104
|
+
*/
|
|
105
|
+
async listSessionKeys() {
|
|
106
|
+
const transcriptDir = this.transcriptsDir;
|
|
107
|
+
const sessionKeys = /* @__PURE__ */ new Set();
|
|
108
|
+
try {
|
|
109
|
+
const typeEntries = await readdir(transcriptDir, { withFileTypes: true });
|
|
110
|
+
for (const typeEnt of typeEntries) {
|
|
111
|
+
if (!typeEnt.isDirectory()) continue;
|
|
112
|
+
const typeDir = path.join(transcriptDir, typeEnt.name);
|
|
113
|
+
const idEntries = await readdir(typeDir, { withFileTypes: true });
|
|
114
|
+
for (const idEnt of idEntries) {
|
|
115
|
+
if (!idEnt.isDirectory()) continue;
|
|
116
|
+
const chanDir = path.join(typeDir, idEnt.name);
|
|
117
|
+
const files = (await readdir(chanDir)).filter((f) => f.endsWith(".jsonl")).sort();
|
|
118
|
+
const last = files[files.length - 1];
|
|
119
|
+
if (!last) continue;
|
|
120
|
+
try {
|
|
121
|
+
const raw = await readFile(path.join(chanDir, last), "utf-8");
|
|
122
|
+
const firstLine = raw.split("\n").find((l) => l.trim().length > 0);
|
|
123
|
+
if (!firstLine) continue;
|
|
124
|
+
const entry = JSON.parse(firstLine);
|
|
125
|
+
if (typeof entry.sessionKey === "string" && entry.sessionKey.length > 0) {
|
|
126
|
+
sessionKeys.add(entry.sessionKey);
|
|
127
|
+
}
|
|
128
|
+
} catch {
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
} catch {
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
return Array.from(sessionKeys);
|
|
136
|
+
}
|
|
137
|
+
getToolUsagePath(sessionKey) {
|
|
138
|
+
const p = this.getTranscriptPath(sessionKey);
|
|
139
|
+
return { dir: p.dir, file: p.file, alternateDir: p.alternateDir, legacyDir: p.legacyDir };
|
|
140
|
+
}
|
|
141
|
+
async selectStorageDirForWrite(root, dir, legacyDir, sessionKey, alternateDir) {
|
|
142
|
+
const channelDir = await resolveSafeStoragePath(root, dir);
|
|
143
|
+
const encodedStatus = await this.directorySessionStatus(root, dir, sessionKey);
|
|
144
|
+
if (encodedStatus === "matches" || encodedStatus === "empty") return { dir, channelDir };
|
|
145
|
+
if (legacyDir) {
|
|
146
|
+
const legacyChannelDir = await resolveSafeStoragePath(root, legacyDir);
|
|
147
|
+
if (await this.directorySessionStatus(root, legacyDir, sessionKey) === "matches") {
|
|
148
|
+
return { dir: legacyDir, channelDir: legacyChannelDir };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (encodedStatus === "missing") return { dir, channelDir };
|
|
152
|
+
if (alternateDir) {
|
|
153
|
+
const alternateChannelDir = await resolveSafeStoragePath(root, alternateDir);
|
|
154
|
+
const alternateStatus = await this.directorySessionStatus(root, alternateDir, sessionKey);
|
|
155
|
+
if (alternateStatus === "missing" || alternateStatus === "empty" || alternateStatus === "matches") {
|
|
156
|
+
return { dir: alternateDir, channelDir: alternateChannelDir };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
throw new Error(`transcript storage path collision for session: ${sessionKey ?? "(unknown)"}`);
|
|
160
|
+
}
|
|
161
|
+
async directorySessionStatus(root, dir, sessionKey) {
|
|
162
|
+
let channelDir;
|
|
163
|
+
try {
|
|
164
|
+
channelDir = await resolveSafeStoragePath(root, dir);
|
|
165
|
+
if (!(await stat(channelDir)).isDirectory()) return "occupied";
|
|
166
|
+
} catch (err) {
|
|
167
|
+
const code = err && typeof err === "object" && "code" in err ? err.code : void 0;
|
|
168
|
+
if (code === "ENOENT") return "missing";
|
|
169
|
+
throw err;
|
|
170
|
+
}
|
|
171
|
+
let names;
|
|
172
|
+
try {
|
|
173
|
+
names = (await readdir(channelDir)).filter((file) => file.endsWith(".jsonl"));
|
|
174
|
+
} catch {
|
|
175
|
+
return "occupied";
|
|
176
|
+
}
|
|
177
|
+
const fileSizes = await this.directoryJsonlFileSizes(root, dir, names);
|
|
178
|
+
if (!fileSizes) return "occupied";
|
|
179
|
+
if (!sessionKey) return "matches";
|
|
180
|
+
const cacheKey = this.directoryOwnershipCacheKey(root, dir, sessionKey);
|
|
181
|
+
const cached = this.directoryOwnershipCache.get(cacheKey);
|
|
182
|
+
if (cached && this.sameFileSizes(cached.fileSizes, fileSizes)) {
|
|
183
|
+
return cached.status;
|
|
184
|
+
}
|
|
185
|
+
let hasEntries = false;
|
|
186
|
+
let hasMatchingEntry = false;
|
|
187
|
+
for (const name of names) {
|
|
188
|
+
const filePath = await resolveSafeStoragePath(root, dir, name).catch(() => null);
|
|
189
|
+
if (filePath === null) return "occupied";
|
|
190
|
+
try {
|
|
191
|
+
const raw = await readFile(filePath, "utf-8");
|
|
192
|
+
for (const line of raw.split("\n")) {
|
|
193
|
+
if (!line.trim()) continue;
|
|
194
|
+
hasEntries = true;
|
|
195
|
+
try {
|
|
196
|
+
const obj = JSON.parse(line);
|
|
197
|
+
if (obj.sessionKey === sessionKey) {
|
|
198
|
+
hasMatchingEntry = true;
|
|
199
|
+
} else {
|
|
200
|
+
return "occupied";
|
|
201
|
+
}
|
|
202
|
+
} catch {
|
|
203
|
+
return "occupied";
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} catch {
|
|
207
|
+
return "occupied";
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const status = hasMatchingEntry ? "matches" : hasEntries ? "occupied" : "empty";
|
|
211
|
+
if (status === "matches" || status === "empty") {
|
|
212
|
+
this.directoryOwnershipCache.set(cacheKey, { status, fileSizes });
|
|
213
|
+
}
|
|
214
|
+
return status;
|
|
215
|
+
}
|
|
216
|
+
directoryOwnershipCacheKey(root, dir, sessionKey) {
|
|
217
|
+
return `${path.resolve(root)}\0${dir}\0${sessionKey}`;
|
|
218
|
+
}
|
|
219
|
+
sameFileSizes(left, right) {
|
|
220
|
+
if (left.size !== right.size) return false;
|
|
221
|
+
for (const [name, size] of left) {
|
|
222
|
+
if (right.get(name) !== size) return false;
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
async directoryJsonlFileSizes(root, dir, names) {
|
|
227
|
+
const fileSizes = /* @__PURE__ */ new Map();
|
|
228
|
+
for (const name of names) {
|
|
229
|
+
const filePath = await resolveSafeStoragePath(root, dir, name).catch(() => null);
|
|
230
|
+
if (filePath === null) return null;
|
|
231
|
+
const fileInfo = await stat(filePath).catch(() => null);
|
|
232
|
+
if (!fileInfo?.isFile()) return null;
|
|
233
|
+
fileSizes.set(name, Math.max(0, fileInfo.size));
|
|
234
|
+
}
|
|
235
|
+
return fileSizes;
|
|
236
|
+
}
|
|
237
|
+
async rememberDirectoryOwnership(root, dir, sessionKey) {
|
|
238
|
+
try {
|
|
239
|
+
const channelDir = await resolveSafeStoragePath(root, dir);
|
|
240
|
+
const names = (await readdir(channelDir)).filter((file) => file.endsWith(".jsonl"));
|
|
241
|
+
const fileSizes = await this.directoryJsonlFileSizes(root, dir, names);
|
|
242
|
+
if (!fileSizes) return;
|
|
243
|
+
this.directoryOwnershipCache.set(
|
|
244
|
+
this.directoryOwnershipCacheKey(root, dir, sessionKey),
|
|
245
|
+
{ status: "matches", fileSizes }
|
|
246
|
+
);
|
|
247
|
+
} catch {
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
async getSessionStorageFiles(root, dir, legacyDir, alternateDir) {
|
|
251
|
+
const files = [];
|
|
252
|
+
const seenDirs = /* @__PURE__ */ new Set();
|
|
253
|
+
for (const candidateDir of [dir, alternateDir, legacyDir]) {
|
|
254
|
+
if (!candidateDir || seenDirs.has(candidateDir)) continue;
|
|
255
|
+
seenDirs.add(candidateDir);
|
|
256
|
+
let channelDir;
|
|
257
|
+
try {
|
|
258
|
+
channelDir = await resolveSafeStoragePath(root, candidateDir);
|
|
259
|
+
} catch {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
let names;
|
|
263
|
+
try {
|
|
264
|
+
names = (await readdir(channelDir)).filter((file) => file.endsWith(".jsonl")).sort();
|
|
265
|
+
} catch {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
for (const name of names) {
|
|
269
|
+
const filePath = await resolveSafeStoragePath(root, candidateDir, name).catch(() => null);
|
|
270
|
+
if (filePath === null) continue;
|
|
271
|
+
files.push({
|
|
272
|
+
cacheKey: path.join(candidateDir, name),
|
|
273
|
+
name,
|
|
274
|
+
path: filePath
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return files.sort((a, b) => a.cacheKey.localeCompare(b.cacheKey));
|
|
279
|
+
}
|
|
280
|
+
async appendToolUse(entry) {
|
|
281
|
+
const { dir, file, alternateDir, legacyDir } = this.getToolUsagePath(entry.sessionKey);
|
|
282
|
+
const { dir: writeDir, channelDir } = await this.selectStorageDirForWrite(
|
|
283
|
+
this.toolUsageDir,
|
|
284
|
+
dir,
|
|
285
|
+
legacyDir,
|
|
286
|
+
entry.sessionKey,
|
|
287
|
+
alternateDir
|
|
288
|
+
);
|
|
289
|
+
await mkdir(channelDir, { recursive: true });
|
|
290
|
+
const filePath = await resolveSafeStoragePath(this.toolUsageDir, writeDir, file);
|
|
291
|
+
await appendFile(filePath, JSON.stringify(entry) + "\n", "utf-8");
|
|
292
|
+
await this.rememberDirectoryOwnership(this.toolUsageDir, writeDir, entry.sessionKey);
|
|
293
|
+
}
|
|
294
|
+
async readToolUse(sessionKey, startTime, endTime) {
|
|
295
|
+
const { dir, alternateDir, legacyDir } = this.getToolUsagePath(sessionKey);
|
|
296
|
+
try {
|
|
297
|
+
const files = await this.getSessionStorageFiles(this.toolUsageDir, dir, legacyDir, alternateDir);
|
|
298
|
+
const out = [];
|
|
299
|
+
for (const file of files) {
|
|
300
|
+
const raw = await readFile(file.path, "utf-8");
|
|
301
|
+
for (const line of raw.split("\n")) {
|
|
302
|
+
if (!line.trim()) continue;
|
|
303
|
+
try {
|
|
304
|
+
const obj = JSON.parse(line);
|
|
305
|
+
const ts = new Date(String(obj.timestamp ?? "")).getTime();
|
|
306
|
+
if (!Number.isFinite(ts)) continue;
|
|
307
|
+
if (ts >= startTime.getTime() && ts < endTime.getTime()) {
|
|
308
|
+
if (typeof obj.tool === "string" && typeof obj.sessionKey === "string") {
|
|
309
|
+
if (obj.sessionKey === sessionKey) {
|
|
310
|
+
out.push({ timestamp: obj.timestamp, sessionKey: obj.sessionKey, tool: obj.tool });
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
} catch {
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return out;
|
|
319
|
+
} catch {
|
|
320
|
+
return [];
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
async estimateSessionFootprint(sessionKey) {
|
|
324
|
+
const { dir, alternateDir, legacyDir } = this.getTranscriptPath(sessionKey);
|
|
325
|
+
let bytes = 0;
|
|
326
|
+
try {
|
|
327
|
+
const files = await this.getSessionStorageFiles(this.transcriptsDir, dir, legacyDir, alternateDir);
|
|
328
|
+
const cached = this.sessionFootprintCache.get(sessionKey);
|
|
329
|
+
if (!cached) {
|
|
330
|
+
const fileBytes = /* @__PURE__ */ new Map();
|
|
331
|
+
const fileSizes = /* @__PURE__ */ new Map();
|
|
332
|
+
for (const file of files) {
|
|
333
|
+
try {
|
|
334
|
+
const fileInfo = await stat(file.path);
|
|
335
|
+
const sessionBytes = await this.estimateSessionBytesInFile(
|
|
336
|
+
file.path,
|
|
337
|
+
sessionKey
|
|
338
|
+
);
|
|
339
|
+
fileBytes.set(file.cacheKey, sessionBytes);
|
|
340
|
+
fileSizes.set(file.cacheKey, Math.max(0, fileInfo.size));
|
|
341
|
+
bytes += sessionBytes;
|
|
342
|
+
} catch {
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
this.sessionFootprintCache.set(sessionKey, { totalBytes: bytes, fileBytes, fileSizes });
|
|
346
|
+
} else {
|
|
347
|
+
bytes = cached.totalBytes;
|
|
348
|
+
const seen = new Set(files.map((file) => file.cacheKey));
|
|
349
|
+
for (const [cachedFile, cachedSessionBytes] of cached.fileBytes.entries()) {
|
|
350
|
+
if (!seen.has(cachedFile)) {
|
|
351
|
+
bytes -= cachedSessionBytes;
|
|
352
|
+
cached.fileBytes.delete(cachedFile);
|
|
353
|
+
cached.fileSizes.delete(cachedFile);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
for (const file of files) {
|
|
357
|
+
if (cached.fileBytes.has(file.cacheKey)) continue;
|
|
358
|
+
try {
|
|
359
|
+
const fileInfo = await stat(file.path);
|
|
360
|
+
const sessionBytes = await this.estimateSessionBytesInFile(file.path, sessionKey);
|
|
361
|
+
cached.fileBytes.set(file.cacheKey, sessionBytes);
|
|
362
|
+
cached.fileSizes.set(file.cacheKey, Math.max(0, fileInfo.size));
|
|
363
|
+
bytes += sessionBytes;
|
|
364
|
+
} catch {
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
for (const file of files) {
|
|
368
|
+
try {
|
|
369
|
+
const fileInfo = await stat(file.path);
|
|
370
|
+
const size = Math.max(0, fileInfo.size);
|
|
371
|
+
const previousSessionBytes = cached.fileBytes.get(file.cacheKey) ?? 0;
|
|
372
|
+
const previousSize = cached.fileSizes.get(file.cacheKey) ?? -1;
|
|
373
|
+
if (size !== previousSize) {
|
|
374
|
+
const sessionBytes = await this.estimateSessionBytesInFile(file.path, sessionKey);
|
|
375
|
+
cached.fileBytes.set(file.cacheKey, sessionBytes);
|
|
376
|
+
cached.fileSizes.set(file.cacheKey, size);
|
|
377
|
+
bytes += sessionBytes - previousSessionBytes;
|
|
378
|
+
}
|
|
379
|
+
} catch {
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (bytes < 0) bytes = 0;
|
|
383
|
+
cached.totalBytes = bytes;
|
|
384
|
+
}
|
|
385
|
+
} catch {
|
|
386
|
+
this.sessionFootprintCache.delete(sessionKey);
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
bytes,
|
|
390
|
+
tokens: Math.floor(bytes / _TranscriptManager.CHARS_PER_TOKEN)
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
async estimateSessionBytesInFile(filePath, sessionKey) {
|
|
394
|
+
try {
|
|
395
|
+
const raw = await readFile(filePath, "utf-8");
|
|
396
|
+
let total = 0;
|
|
397
|
+
for (const line of raw.split("\n")) {
|
|
398
|
+
if (!line.trim()) continue;
|
|
399
|
+
try {
|
|
400
|
+
const parsed = JSON.parse(line);
|
|
401
|
+
if (parsed.sessionKey === sessionKey) {
|
|
402
|
+
total += Buffer.byteLength(`${line}
|
|
403
|
+
`, "utf-8");
|
|
404
|
+
}
|
|
405
|
+
} catch {
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return total;
|
|
409
|
+
} catch {
|
|
410
|
+
return 0;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Check if a file is a legacy flat transcript file (YYYY-MM-DD.jsonl format).
|
|
415
|
+
*/
|
|
416
|
+
isLegacyTranscriptFile(filename) {
|
|
417
|
+
return /^\d{4}-\d{2}-\d{2}\.jsonl$/.test(filename);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Append a turn to the appropriate transcript file.
|
|
421
|
+
* Files are stored hierarchically: transcripts/{channelType}/{channelId}.jsonl
|
|
422
|
+
*
|
|
423
|
+
* Skips channel types in config.transcriptSkipChannelTypes (e.g., "cron").
|
|
424
|
+
*/
|
|
425
|
+
async append(entry) {
|
|
426
|
+
try {
|
|
427
|
+
const { dir, file, channelType, alternateDir, legacyDir } = this.getTranscriptPath(entry.sessionKey);
|
|
428
|
+
if (this.config.transcriptSkipChannelTypes.includes(channelType)) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const { dir: writeDir, channelDir } = await this.selectStorageDirForWrite(
|
|
432
|
+
this.transcriptsDir,
|
|
433
|
+
dir,
|
|
434
|
+
legacyDir,
|
|
435
|
+
entry.sessionKey,
|
|
436
|
+
alternateDir
|
|
437
|
+
);
|
|
438
|
+
const filePath = await resolveSafeStoragePath(this.transcriptsDir, writeDir, file);
|
|
439
|
+
await mkdir(channelDir, { recursive: true });
|
|
440
|
+
const line = JSON.stringify(entry) + "\n";
|
|
441
|
+
await appendFile(filePath, line, "utf-8");
|
|
442
|
+
await this.rememberDirectoryOwnership(this.transcriptsDir, writeDir, entry.sessionKey);
|
|
443
|
+
log.debug(`appended transcript entry for ${entry.sessionKey}: ${entry.turnId}`);
|
|
444
|
+
} catch (err) {
|
|
445
|
+
log.error("failed to append transcript entry:", err);
|
|
446
|
+
throw err;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Get all transcript files from the hierarchical directory structure.
|
|
451
|
+
* Recursively finds all .jsonl files in transcripts/{channelType}/{channelId}/ subdirectories.
|
|
452
|
+
*/
|
|
453
|
+
async getAllTranscriptFiles() {
|
|
454
|
+
const files = [];
|
|
455
|
+
try {
|
|
456
|
+
const entries = await readdir(this.transcriptsDir, { withFileTypes: true });
|
|
457
|
+
for (const entry of entries) {
|
|
458
|
+
if (entry.isDirectory()) {
|
|
459
|
+
const channelTypeDir = path.join(this.transcriptsDir, entry.name);
|
|
460
|
+
try {
|
|
461
|
+
const channelTypeEntries = await readdir(channelTypeDir, { withFileTypes: true });
|
|
462
|
+
for (const channelTypeEntry of channelTypeEntries) {
|
|
463
|
+
if (channelTypeEntry.isDirectory()) {
|
|
464
|
+
const channelDir = path.join(channelTypeDir, channelTypeEntry.name);
|
|
465
|
+
try {
|
|
466
|
+
const channelFiles = await readdir(channelDir);
|
|
467
|
+
for (const file of channelFiles) {
|
|
468
|
+
if (file.endsWith(".jsonl")) {
|
|
469
|
+
files.push(path.join(entry.name, channelTypeEntry.name, file));
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
} catch {
|
|
473
|
+
}
|
|
474
|
+
} else if (channelTypeEntry.isFile() && channelTypeEntry.name.endsWith(".jsonl")) {
|
|
475
|
+
files.push(path.join(entry.name, channelTypeEntry.name));
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
} catch {
|
|
479
|
+
}
|
|
480
|
+
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
481
|
+
files.push(entry.name);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
} catch {
|
|
485
|
+
}
|
|
486
|
+
return files;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Read transcript entries for a date range.
|
|
490
|
+
* Returns entries within the time range, optionally filtered by sessionKey.
|
|
491
|
+
* Reads from all channel subdirectories in the hierarchical structure.
|
|
492
|
+
*/
|
|
493
|
+
async readRange(startTime, endTime, sessionKey) {
|
|
494
|
+
const start = new Date(startTime);
|
|
495
|
+
const end = new Date(endTime);
|
|
496
|
+
const entries = [];
|
|
497
|
+
try {
|
|
498
|
+
const transcriptFiles = await this.getAllTranscriptFiles();
|
|
499
|
+
for (const relativePath of transcriptFiles) {
|
|
500
|
+
const filePath = path.join(this.transcriptsDir, relativePath);
|
|
501
|
+
try {
|
|
502
|
+
const content = await readFile(filePath, "utf-8");
|
|
503
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
504
|
+
for (const line of lines) {
|
|
505
|
+
try {
|
|
506
|
+
const entry = JSON.parse(line);
|
|
507
|
+
const entryTime = new Date(entry.timestamp);
|
|
508
|
+
if (entryTime >= start && entryTime <= end) {
|
|
509
|
+
if (!sessionKey || entry.sessionKey === sessionKey) {
|
|
510
|
+
entries.push(entry);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
} catch {
|
|
514
|
+
log.debug(`skipped malformed transcript line in ${relativePath}`);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
} catch {
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
entries.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
521
|
+
log.debug(`read ${entries.length} transcript entries from ${transcriptFiles.length} file(s)`);
|
|
522
|
+
return entries;
|
|
523
|
+
} catch (err) {
|
|
524
|
+
log.error("failed to read transcript range:", err);
|
|
525
|
+
return [];
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Read the last N hours of transcript.
|
|
530
|
+
*
|
|
531
|
+
* Fast path: when sessionKey is given, reads only the 1-2 daily files for that
|
|
532
|
+
* specific channel instead of scanning all 95+ transcript files across all channels.
|
|
533
|
+
*/
|
|
534
|
+
async readRecent(hours, sessionKey) {
|
|
535
|
+
const end = /* @__PURE__ */ new Date();
|
|
536
|
+
const start = new Date(end.getTime() - hours * 60 * 60 * 1e3);
|
|
537
|
+
if (sessionKey) {
|
|
538
|
+
return this.readRecentForSession(start, end, sessionKey);
|
|
539
|
+
}
|
|
540
|
+
return this.readRange(start.toISOString(), end.toISOString(), void 0);
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Optimized read for a specific session: only looks in that session's channel
|
|
544
|
+
* directory and only reads files whose date falls within the lookback window.
|
|
545
|
+
*/
|
|
546
|
+
async readRecentForSession(start, end, sessionKey) {
|
|
547
|
+
const { dir, alternateDir, legacyDir } = this.getTranscriptPath(sessionKey);
|
|
548
|
+
const dateStrings = /* @__PURE__ */ new Set();
|
|
549
|
+
const cursor = new Date(start);
|
|
550
|
+
while (cursor <= end) {
|
|
551
|
+
dateStrings.add(cursor.toISOString().slice(0, 10));
|
|
552
|
+
cursor.setDate(cursor.getDate() + 1);
|
|
553
|
+
}
|
|
554
|
+
dateStrings.add(end.toISOString().slice(0, 10));
|
|
555
|
+
const entries = [];
|
|
556
|
+
const files = await this.getSessionStorageFiles(this.transcriptsDir, dir, legacyDir, alternateDir);
|
|
557
|
+
for (const file of files) {
|
|
558
|
+
const dateStr = file.name.slice(0, 10);
|
|
559
|
+
if (!dateStrings.has(dateStr)) continue;
|
|
560
|
+
try {
|
|
561
|
+
const content = await readFile(file.path, "utf-8");
|
|
562
|
+
for (const line of content.split("\n")) {
|
|
563
|
+
if (!line.trim()) continue;
|
|
564
|
+
try {
|
|
565
|
+
const entry = JSON.parse(line);
|
|
566
|
+
const ts = new Date(entry.timestamp);
|
|
567
|
+
if (ts >= start && ts <= end && entry.sessionKey === sessionKey) {
|
|
568
|
+
entries.push(entry);
|
|
569
|
+
}
|
|
570
|
+
} catch {
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
} catch {
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
entries.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
577
|
+
log.debug(`readRecentForSession: ${entries.length} entries from ${files.length} file(s) in ${dir}`);
|
|
578
|
+
return entries;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Cleanup old transcript entries that are older than retentionDays.
|
|
582
|
+
* For hierarchical structure, reads each file and rewrites without old entries.
|
|
583
|
+
* Legacy flat files are deleted if their date is older than retentionDays.
|
|
584
|
+
* Returns the number of files processed (cleaned or deleted).
|
|
585
|
+
*/
|
|
586
|
+
async cleanup(retentionDays) {
|
|
587
|
+
if (retentionDays <= 0) {
|
|
588
|
+
log.warn("cleanup called with invalid retentionDays:", retentionDays);
|
|
589
|
+
return 0;
|
|
590
|
+
}
|
|
591
|
+
const cutoff = /* @__PURE__ */ new Date();
|
|
592
|
+
cutoff.setDate(cutoff.getDate() - retentionDays);
|
|
593
|
+
cutoff.setHours(0, 0, 0, 0);
|
|
594
|
+
let processed = 0;
|
|
595
|
+
try {
|
|
596
|
+
const entries = await readdir(this.transcriptsDir, { withFileTypes: true });
|
|
597
|
+
for (const entry of entries) {
|
|
598
|
+
if (entry.isDirectory()) {
|
|
599
|
+
const channelTypeDir = path.join(this.transcriptsDir, entry.name);
|
|
600
|
+
try {
|
|
601
|
+
const channelTypeEntries = await readdir(channelTypeDir, { withFileTypes: true });
|
|
602
|
+
for (const channelTypeEntry of channelTypeEntries) {
|
|
603
|
+
if (channelTypeEntry.isDirectory()) {
|
|
604
|
+
const channelDir = path.join(channelTypeDir, channelTypeEntry.name);
|
|
605
|
+
try {
|
|
606
|
+
const channelFiles = await readdir(channelDir);
|
|
607
|
+
for (const file of channelFiles) {
|
|
608
|
+
if (!file.endsWith(".jsonl")) continue;
|
|
609
|
+
const filePath = path.join(channelDir, file);
|
|
610
|
+
if (this.isLegacyTranscriptFile(file)) {
|
|
611
|
+
const dateStr = file.slice(0, 10);
|
|
612
|
+
const fileDate = new Date(dateStr);
|
|
613
|
+
if (!isNaN(fileDate.getTime()) && fileDate < cutoff) {
|
|
614
|
+
try {
|
|
615
|
+
await unlink(filePath);
|
|
616
|
+
processed++;
|
|
617
|
+
log.debug(`deleted old daily transcript file: ${entry.name}/${channelTypeEntry.name}/${file}`);
|
|
618
|
+
} catch (err) {
|
|
619
|
+
log.error(`failed to delete transcript file ${filePath}:`, err);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
} else {
|
|
623
|
+
const cleaned = await this.cleanupTranscriptFile(filePath, cutoff);
|
|
624
|
+
if (cleaned) {
|
|
625
|
+
processed++;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
} catch (err) {
|
|
630
|
+
log.debug(`failed to process channel directory ${entry.name}/${channelTypeEntry.name}:`, err);
|
|
631
|
+
}
|
|
632
|
+
} else if (channelTypeEntry.isFile() && channelTypeEntry.name.endsWith(".jsonl")) {
|
|
633
|
+
const filePath = path.join(channelTypeDir, channelTypeEntry.name);
|
|
634
|
+
const cleaned = await this.cleanupTranscriptFile(filePath, cutoff);
|
|
635
|
+
if (cleaned) {
|
|
636
|
+
processed++;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
} catch (err) {
|
|
641
|
+
log.debug(`failed to process channel type directory ${entry.name}:`, err);
|
|
642
|
+
}
|
|
643
|
+
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
644
|
+
if (this.isLegacyTranscriptFile(entry.name)) {
|
|
645
|
+
const dateStr = entry.name.slice(0, 10);
|
|
646
|
+
const fileDate = new Date(dateStr);
|
|
647
|
+
if (!isNaN(fileDate.getTime()) && fileDate < cutoff) {
|
|
648
|
+
const filePath = path.join(this.transcriptsDir, entry.name);
|
|
649
|
+
try {
|
|
650
|
+
await unlink(filePath);
|
|
651
|
+
processed++;
|
|
652
|
+
log.debug(`deleted old legacy transcript file: ${entry.name}`);
|
|
653
|
+
} catch (err) {
|
|
654
|
+
log.error(`failed to delete legacy transcript file ${entry.name}:`, err);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (processed > 0) {
|
|
661
|
+
log.info(`cleaned up ${processed} transcript file(s) older than ${retentionDays} days`);
|
|
662
|
+
}
|
|
663
|
+
return processed;
|
|
664
|
+
} catch (err) {
|
|
665
|
+
log.error("failed to cleanup old transcripts:", err);
|
|
666
|
+
return 0;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Clean up old entries from a single transcript file.
|
|
671
|
+
* Reads the file, filters out entries older than cutoff, and rewrites if needed.
|
|
672
|
+
* Returns true if the file was processed (cleaned or deleted).
|
|
673
|
+
*/
|
|
674
|
+
async cleanupTranscriptFile(filePath, cutoff) {
|
|
675
|
+
try {
|
|
676
|
+
const content = await readFile(filePath, "utf-8");
|
|
677
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
678
|
+
const validLines = [];
|
|
679
|
+
let hasOldEntries = false;
|
|
680
|
+
for (const line of lines) {
|
|
681
|
+
try {
|
|
682
|
+
const entry = JSON.parse(line);
|
|
683
|
+
const entryTime = new Date(entry.timestamp);
|
|
684
|
+
if (entryTime >= cutoff) {
|
|
685
|
+
validLines.push(line);
|
|
686
|
+
} else {
|
|
687
|
+
hasOldEntries = true;
|
|
688
|
+
}
|
|
689
|
+
} catch {
|
|
690
|
+
validLines.push(line);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (validLines.length === 0) {
|
|
694
|
+
try {
|
|
695
|
+
await unlink(filePath);
|
|
696
|
+
log.debug(`deleted empty transcript file: ${filePath}`);
|
|
697
|
+
return true;
|
|
698
|
+
} catch (err) {
|
|
699
|
+
log.error(`failed to delete empty transcript file ${filePath}:`, err);
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
if (hasOldEntries) {
|
|
704
|
+
await writeFile(filePath, validLines.join("\n") + "\n", "utf-8");
|
|
705
|
+
log.debug(`cleaned old entries from transcript file: ${filePath}`);
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
return false;
|
|
709
|
+
} catch (err) {
|
|
710
|
+
return false;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Save a checkpoint to preserve conversation context.
|
|
715
|
+
* Called when compaction is detected.
|
|
716
|
+
*/
|
|
717
|
+
async saveCheckpoint(checkpoint) {
|
|
718
|
+
try {
|
|
719
|
+
await writeFile(this.checkpointPath, JSON.stringify(checkpoint, null, 2), "utf-8");
|
|
720
|
+
log.info(`saved checkpoint for session ${checkpoint.sessionKey} with ${checkpoint.turns.length} turn(s)`);
|
|
721
|
+
} catch (err) {
|
|
722
|
+
log.error("failed to save checkpoint:", err);
|
|
723
|
+
throw err;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Load a checkpoint if one exists and is not expired.
|
|
728
|
+
* Returns null if no checkpoint exists or if it has expired.
|
|
729
|
+
*/
|
|
730
|
+
async loadCheckpoint(sessionKey) {
|
|
731
|
+
try {
|
|
732
|
+
const raw = await readFile(this.checkpointPath, "utf-8");
|
|
733
|
+
const checkpoint = JSON.parse(raw);
|
|
734
|
+
if (!checkpoint.sessionKey || !checkpoint.capturedAt || !checkpoint.ttl || !Array.isArray(checkpoint.turns)) {
|
|
735
|
+
log.warn("checkpoint file has invalid structure");
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
if (sessionKey && checkpoint.sessionKey !== sessionKey) {
|
|
739
|
+
log.debug(`checkpoint session mismatch: ${checkpoint.sessionKey} vs ${sessionKey}`);
|
|
740
|
+
return null;
|
|
741
|
+
}
|
|
742
|
+
const ttl = new Date(checkpoint.ttl);
|
|
743
|
+
if (isNaN(ttl.getTime())) {
|
|
744
|
+
log.warn("checkpoint has invalid TTL format");
|
|
745
|
+
return null;
|
|
746
|
+
}
|
|
747
|
+
if (ttl < /* @__PURE__ */ new Date()) {
|
|
748
|
+
log.info(`checkpoint expired at ${checkpoint.ttl}`);
|
|
749
|
+
return null;
|
|
750
|
+
}
|
|
751
|
+
log.info(`loaded checkpoint with ${checkpoint.turns.length} turn(s), expires at ${checkpoint.ttl}`);
|
|
752
|
+
return checkpoint;
|
|
753
|
+
} catch (err) {
|
|
754
|
+
log.debug("no valid checkpoint found");
|
|
755
|
+
return null;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Clear (delete) the checkpoint file.
|
|
760
|
+
* Called after successful injection of checkpoint context.
|
|
761
|
+
*/
|
|
762
|
+
async clearCheckpoint() {
|
|
763
|
+
try {
|
|
764
|
+
await unlink(this.checkpointPath);
|
|
765
|
+
log.info("cleared checkpoint");
|
|
766
|
+
} catch (err) {
|
|
767
|
+
log.debug("no checkpoint to clear");
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Format entries for recall injection.
|
|
772
|
+
* Returns a formatted string suitable for injecting into agent context.
|
|
773
|
+
*
|
|
774
|
+
* Format:
|
|
775
|
+
* ## Recent Conversation (last X hours)
|
|
776
|
+
* [10:32] User: message content
|
|
777
|
+
* [10:33] Assistant: response content
|
|
778
|
+
*
|
|
779
|
+
* Content is trimmed to approximately maxTokens.
|
|
780
|
+
*/
|
|
781
|
+
formatForRecall(entries, maxTokens) {
|
|
782
|
+
if (entries.length === 0) {
|
|
783
|
+
return "";
|
|
784
|
+
}
|
|
785
|
+
const maxChars = maxTokens * _TranscriptManager.CHARS_PER_TOKEN;
|
|
786
|
+
const lines = [];
|
|
787
|
+
const firstEntry = new Date(entries[0].timestamp);
|
|
788
|
+
const lastEntry = new Date(entries[entries.length - 1].timestamp);
|
|
789
|
+
const hoursDiff = Math.round((lastEntry.getTime() - firstEntry.getTime()) / (60 * 60 * 1e3));
|
|
790
|
+
if (hoursDiff < 1) {
|
|
791
|
+
lines.push("## Recent Conversation (last few minutes)");
|
|
792
|
+
} else {
|
|
793
|
+
lines.push(`## Recent Conversation (last ${hoursDiff} hour${hoursDiff === 1 ? "" : "s"})`);
|
|
794
|
+
}
|
|
795
|
+
lines.push("");
|
|
796
|
+
const formattedEntries = [];
|
|
797
|
+
for (const entry of entries) {
|
|
798
|
+
const time = new Date(entry.timestamp);
|
|
799
|
+
const timeStr = time.toLocaleTimeString("en-US", {
|
|
800
|
+
hour: "2-digit",
|
|
801
|
+
minute: "2-digit",
|
|
802
|
+
hour12: false
|
|
803
|
+
});
|
|
804
|
+
const roleLabel = entry.role === "user" ? "User" : "Assistant";
|
|
805
|
+
formattedEntries.push(`[${timeStr}] ${roleLabel}: ${entry.content}`);
|
|
806
|
+
}
|
|
807
|
+
let totalChars = lines.join("\n").length;
|
|
808
|
+
const selectedEntries = [];
|
|
809
|
+
for (let i = formattedEntries.length - 1; i >= 0; i--) {
|
|
810
|
+
const entry = formattedEntries[i];
|
|
811
|
+
const entryChars = entry.length + 1;
|
|
812
|
+
if (totalChars + entryChars > maxChars && selectedEntries.length > 0) {
|
|
813
|
+
break;
|
|
814
|
+
}
|
|
815
|
+
selectedEntries.unshift(entry);
|
|
816
|
+
totalChars += entryChars;
|
|
817
|
+
}
|
|
818
|
+
lines.push(...selectedEntries);
|
|
819
|
+
lines.push("");
|
|
820
|
+
const result = lines.join("\n");
|
|
821
|
+
log.debug(`formatted ${selectedEntries.length}/${entries.length} transcript entries for recall (~${result.length} chars)`);
|
|
822
|
+
return result;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Create a checkpoint from the current buffer state.
|
|
826
|
+
* Helper method for creating checkpoints before compaction.
|
|
827
|
+
*/
|
|
828
|
+
createCheckpoint(sessionKey, turns, ttlHours) {
|
|
829
|
+
const ttl = ttlHours ?? _TranscriptManager.DEFAULT_CHECKPOINT_TTL_HOURS;
|
|
830
|
+
const expiresAt = /* @__PURE__ */ new Date();
|
|
831
|
+
expiresAt.setHours(expiresAt.getHours() + ttl);
|
|
832
|
+
return {
|
|
833
|
+
sessionKey,
|
|
834
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
835
|
+
turns: [...turns],
|
|
836
|
+
// Copy turns to avoid mutation
|
|
837
|
+
ttl: expiresAt.toISOString()
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Get statistics about stored transcripts.
|
|
842
|
+
* Returns counts from the hierarchical directory structure.
|
|
843
|
+
*/
|
|
844
|
+
async getStats() {
|
|
845
|
+
try {
|
|
846
|
+
const allFiles = await this.getAllTranscriptFiles();
|
|
847
|
+
if (allFiles.length === 0) {
|
|
848
|
+
return {
|
|
849
|
+
totalFiles: 0,
|
|
850
|
+
totalEntries: 0,
|
|
851
|
+
oldestFile: null,
|
|
852
|
+
newestFile: null,
|
|
853
|
+
channelTypes: {}
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
const sortedFiles = allFiles.sort();
|
|
857
|
+
let totalEntries = 0;
|
|
858
|
+
const channelTypes = {};
|
|
859
|
+
for (const relativePath of allFiles) {
|
|
860
|
+
const filePath = path.join(this.transcriptsDir, relativePath);
|
|
861
|
+
try {
|
|
862
|
+
const content = await readFile(filePath, "utf-8");
|
|
863
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
864
|
+
totalEntries += lines.length;
|
|
865
|
+
const channelType = relativePath.includes(path.sep) ? relativePath.split(path.sep)[0] : "legacy";
|
|
866
|
+
channelTypes[channelType] = (channelTypes[channelType] || 0) + 1;
|
|
867
|
+
} catch {
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
return {
|
|
871
|
+
totalFiles: allFiles.length,
|
|
872
|
+
totalEntries,
|
|
873
|
+
oldestFile: sortedFiles[0],
|
|
874
|
+
newestFile: sortedFiles[sortedFiles.length - 1],
|
|
875
|
+
channelTypes
|
|
876
|
+
};
|
|
877
|
+
} catch (err) {
|
|
878
|
+
log.error("failed to get transcript stats:", err);
|
|
879
|
+
return {
|
|
880
|
+
totalFiles: 0,
|
|
881
|
+
totalEntries: 0,
|
|
882
|
+
oldestFile: null,
|
|
883
|
+
newestFile: null,
|
|
884
|
+
channelTypes: {}
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
async analyzeIntegrity() {
|
|
889
|
+
return analyzeSessionIntegrity({ memoryDir: this.config.memoryDir });
|
|
890
|
+
}
|
|
891
|
+
async getRecoverySummary(sessionKey) {
|
|
892
|
+
const report = await this.analyzeIntegrity();
|
|
893
|
+
const selectedSessions = sessionKey ? report.sessions.filter((session) => session.sessionKey === sessionKey) : report.sessions;
|
|
894
|
+
const incompleteTurns = selectedSessions.reduce((sum, session) => sum + session.incompleteTurns, 0);
|
|
895
|
+
const brokenChains = selectedSessions.reduce((sum, session) => sum + session.brokenChains, 0);
|
|
896
|
+
const filteredIssues = report.issues.filter((issue) => !sessionKey || issue.sessionKey === sessionKey);
|
|
897
|
+
const issueCount = filteredIssues.length;
|
|
898
|
+
const severeIssueCount = filteredIssues.filter((issue) => issue.severity !== "info").length;
|
|
899
|
+
return {
|
|
900
|
+
generatedAt: report.generatedAt,
|
|
901
|
+
sessionKey,
|
|
902
|
+
healthy: sessionKey ? severeIssueCount === 0 && report.checkpoint.healthy : report.healthy,
|
|
903
|
+
issueCount,
|
|
904
|
+
incompleteTurns,
|
|
905
|
+
brokenChains,
|
|
906
|
+
checkpointHealthy: report.checkpoint.healthy
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
export {
|
|
912
|
+
TranscriptManager
|
|
913
|
+
};
|
|
914
|
+
//# sourceMappingURL=chunk-5375UYTQ.js.map
|