@remnic/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstraction-nodes.d.ts +52 -0
- package/dist/abstraction-nodes.js +15 -0
- package/dist/abstraction-nodes.js.map +1 -0
- package/dist/access-cli.d.ts +5 -0
- package/dist/access-cli.js +308 -0
- package/dist/access-cli.js.map +1 -0
- package/dist/access-http.d.ts +158 -0
- package/dist/access-http.js +32 -0
- package/dist/access-http.js.map +1 -0
- package/dist/access-idempotency.d.ts +31 -0
- package/dist/access-idempotency.js +11 -0
- package/dist/access-idempotency.js.map +1 -0
- package/dist/access-mcp.d.ts +76 -0
- package/dist/access-mcp.js +8 -0
- package/dist/access-mcp.js.map +1 -0
- package/dist/access-schema.d.ts +266 -0
- package/dist/access-schema.js +29 -0
- package/dist/access-schema.js.map +1 -0
- package/dist/access-service.d.ts +614 -0
- package/dist/access-service.js +32 -0
- package/dist/access-service.js.map +1 -0
- package/dist/behavior-learner.d.ts +16 -0
- package/dist/behavior-learner.js +124 -0
- package/dist/behavior-learner.js.map +1 -0
- package/dist/behavior-signals.d.ts +15 -0
- package/dist/behavior-signals.js +11 -0
- package/dist/behavior-signals.js.map +1 -0
- package/dist/bootstrap.d.ts +46 -0
- package/dist/bootstrap.js +9 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/boxes.d.ts +93 -0
- package/dist/boxes.js +14 -0
- package/dist/boxes.js.map +1 -0
- package/dist/buffer.d.ts +22 -0
- package/dist/buffer.js +9 -0
- package/dist/buffer.js.map +1 -0
- package/dist/calibration.d.ts +81 -0
- package/dist/calibration.js +239 -0
- package/dist/calibration.js.map +1 -0
- package/dist/causal-behavior.d.ts +79 -0
- package/dist/causal-behavior.js +190 -0
- package/dist/causal-behavior.js.map +1 -0
- package/dist/causal-chain.d.ts +61 -0
- package/dist/causal-chain.js +24 -0
- package/dist/causal-chain.js.map +1 -0
- package/dist/causal-consolidation.d.ts +71 -0
- package/dist/causal-consolidation.js +211 -0
- package/dist/causal-consolidation.js.map +1 -0
- package/dist/causal-retrieval.d.ts +44 -0
- package/dist/causal-retrieval.js +184 -0
- package/dist/causal-retrieval.js.map +1 -0
- package/dist/causal-trajectory-graph.d.ts +13 -0
- package/dist/causal-trajectory-graph.js +59 -0
- package/dist/causal-trajectory-graph.js.map +1 -0
- package/dist/causal-trajectory.d.ts +68 -0
- package/dist/causal-trajectory.js +18 -0
- package/dist/causal-trajectory.js.map +1 -0
- package/dist/chunk-2CJCWDMR.js +87 -0
- package/dist/chunk-2CJCWDMR.js.map +1 -0
- package/dist/chunk-2NMMFZ5T.js +216 -0
- package/dist/chunk-2NMMFZ5T.js.map +1 -0
- package/dist/chunk-2PO5ZRKV.js +103 -0
- package/dist/chunk-2PO5ZRKV.js.map +1 -0
- package/dist/chunk-3QKK7QOS.js +154 -0
- package/dist/chunk-3QKK7QOS.js.map +1 -0
- package/dist/chunk-3SLRNYNG.js +26 -0
- package/dist/chunk-3SLRNYNG.js.map +1 -0
- package/dist/chunk-4A24LIM2.js +68 -0
- package/dist/chunk-4A24LIM2.js.map +1 -0
- package/dist/chunk-6HZ6AO2P.js +164 -0
- package/dist/chunk-6HZ6AO2P.js.map +1 -0
- package/dist/chunk-763GUIOU.js +302 -0
- package/dist/chunk-763GUIOU.js.map +1 -0
- package/dist/chunk-AAI7JARD.js +173 -0
- package/dist/chunk-AAI7JARD.js.map +1 -0
- package/dist/chunk-B7LOFDVE.js +112 -0
- package/dist/chunk-B7LOFDVE.js.map +1 -0
- package/dist/chunk-BDFZXRSO.js +318 -0
- package/dist/chunk-BDFZXRSO.js.map +1 -0
- package/dist/chunk-BOUYNNYD.js +707 -0
- package/dist/chunk-BOUYNNYD.js.map +1 -0
- package/dist/chunk-BRK4ODMI.js +60 -0
- package/dist/chunk-BRK4ODMI.js.map +1 -0
- package/dist/chunk-C6QPK5GG.js +111 -0
- package/dist/chunk-C6QPK5GG.js.map +1 -0
- package/dist/chunk-C7VW7C3F.js +117 -0
- package/dist/chunk-C7VW7C3F.js.map +1 -0
- package/dist/chunk-CDW777AI.js +621 -0
- package/dist/chunk-CDW777AI.js.map +1 -0
- package/dist/chunk-CULXMQJH.js +185 -0
- package/dist/chunk-CULXMQJH.js.map +1 -0
- package/dist/chunk-CXWFUJR2.js +1203 -0
- package/dist/chunk-CXWFUJR2.js.map +1 -0
- package/dist/chunk-DGXUHMOV.js +61 -0
- package/dist/chunk-DGXUHMOV.js.map +1 -0
- package/dist/chunk-DM2T26WE.js +61 -0
- package/dist/chunk-DM2T26WE.js.map +1 -0
- package/dist/chunk-DORBM6OB.js +81 -0
- package/dist/chunk-DORBM6OB.js.map +1 -0
- package/dist/chunk-DT5TVLJE.js +32 -0
- package/dist/chunk-DT5TVLJE.js.map +1 -0
- package/dist/chunk-EEQLFRUM.js +89 -0
- package/dist/chunk-EEQLFRUM.js.map +1 -0
- package/dist/chunk-EQINRHYR.js +672 -0
- package/dist/chunk-EQINRHYR.js.map +1 -0
- package/dist/chunk-ESSMF2FR.js +146 -0
- package/dist/chunk-ESSMF2FR.js.map +1 -0
- package/dist/chunk-ETOW6ACV.js +158 -0
- package/dist/chunk-ETOW6ACV.js.map +1 -0
- package/dist/chunk-FYIYMQ5N.js +221 -0
- package/dist/chunk-FYIYMQ5N.js.map +1 -0
- package/dist/chunk-G3AG3KZN.js +78 -0
- package/dist/chunk-G3AG3KZN.js.map +1 -0
- package/dist/chunk-GJR6D6KC.js +61 -0
- package/dist/chunk-GJR6D6KC.js.map +1 -0
- package/dist/chunk-GPGBSNKM.js +380 -0
- package/dist/chunk-GPGBSNKM.js.map +1 -0
- package/dist/chunk-H63EDPFJ.js +57 -0
- package/dist/chunk-H63EDPFJ.js.map +1 -0
- package/dist/chunk-HG2NKWR2.js +185 -0
- package/dist/chunk-HG2NKWR2.js.map +1 -0
- package/dist/chunk-HL4DB7TO.js +13 -0
- package/dist/chunk-HL4DB7TO.js.map +1 -0
- package/dist/chunk-HLBYLYRD.js +346 -0
- package/dist/chunk-HLBYLYRD.js.map +1 -0
- package/dist/chunk-HLXVTBF3.js +109 -0
- package/dist/chunk-HLXVTBF3.js.map +1 -0
- package/dist/chunk-IFFFR3MR.js +68 -0
- package/dist/chunk-IFFFR3MR.js.map +1 -0
- package/dist/chunk-ISY75RLM.js +1027 -0
- package/dist/chunk-ISY75RLM.js.map +1 -0
- package/dist/chunk-IZME7KW2.js +1886 -0
- package/dist/chunk-IZME7KW2.js.map +1 -0
- package/dist/chunk-J3BT33K7.js +720 -0
- package/dist/chunk-J3BT33K7.js.map +1 -0
- package/dist/chunk-J47FNDR7.js +113 -0
- package/dist/chunk-J47FNDR7.js.map +1 -0
- package/dist/chunk-JWPLJLDU.js +63 -0
- package/dist/chunk-JWPLJLDU.js.map +1 -0
- package/dist/chunk-K6WK37A6.js +865 -0
- package/dist/chunk-K6WK37A6.js.map +1 -0
- package/dist/chunk-KL4CP4SB.js +130 -0
- package/dist/chunk-KL4CP4SB.js.map +1 -0
- package/dist/chunk-KT4NEUNF.js +315 -0
- package/dist/chunk-KT4NEUNF.js.map +1 -0
- package/dist/chunk-KWBU5S5U.js +42 -0
- package/dist/chunk-KWBU5S5U.js.map +1 -0
- package/dist/chunk-L5RPWGFK.js +59 -0
- package/dist/chunk-L5RPWGFK.js.map +1 -0
- package/dist/chunk-L7WO3MZ4.js +128 -0
- package/dist/chunk-L7WO3MZ4.js.map +1 -0
- package/dist/chunk-LIRZNNUP.js +74 -0
- package/dist/chunk-LIRZNNUP.js.map +1 -0
- package/dist/chunk-LK6SGL53.js +22 -0
- package/dist/chunk-LK6SGL53.js.map +1 -0
- package/dist/chunk-LOBRX7VD.js +200 -0
- package/dist/chunk-LOBRX7VD.js.map +1 -0
- package/dist/chunk-LPSF4OQH.js +47 -0
- package/dist/chunk-LPSF4OQH.js.map +1 -0
- package/dist/chunk-LU3GQNDQ.js +152 -0
- package/dist/chunk-LU3GQNDQ.js.map +1 -0
- package/dist/chunk-M5KEYE5E.js +350 -0
- package/dist/chunk-M5KEYE5E.js.map +1 -0
- package/dist/chunk-M62O4P4T.js +41 -0
- package/dist/chunk-M62O4P4T.js.map +1 -0
- package/dist/chunk-MARWOCVP.js +48 -0
- package/dist/chunk-MARWOCVP.js.map +1 -0
- package/dist/chunk-MDDAA2AO.js +925 -0
- package/dist/chunk-MDDAA2AO.js.map +1 -0
- package/dist/chunk-MWGVGUIS.js +198 -0
- package/dist/chunk-MWGVGUIS.js.map +1 -0
- package/dist/chunk-N5AKDXAI.js +74 -0
- package/dist/chunk-N5AKDXAI.js.map +1 -0
- package/dist/chunk-NGAVDO7E.js +115 -0
- package/dist/chunk-NGAVDO7E.js.map +1 -0
- package/dist/chunk-NTTLPF7F.js +283 -0
- package/dist/chunk-NTTLPF7F.js.map +1 -0
- package/dist/chunk-ONRU4L2N.js +240 -0
- package/dist/chunk-ONRU4L2N.js.map +1 -0
- package/dist/chunk-ORZMT74A.js +209 -0
- package/dist/chunk-ORZMT74A.js.map +1 -0
- package/dist/chunk-OTAVQCSF.js +268 -0
- package/dist/chunk-OTAVQCSF.js.map +1 -0
- package/dist/chunk-PGK3VUHN.js +160 -0
- package/dist/chunk-PGK3VUHN.js.map +1 -0
- package/dist/chunk-Q6FETXJA.js +1362 -0
- package/dist/chunk-Q6FETXJA.js.map +1 -0
- package/dist/chunk-QANCTXQF.js +271 -0
- package/dist/chunk-QANCTXQF.js.map +1 -0
- package/dist/chunk-QCCCQT3O.js +189 -0
- package/dist/chunk-QCCCQT3O.js.map +1 -0
- package/dist/chunk-QDOSNLB4.js +1048 -0
- package/dist/chunk-QDOSNLB4.js.map +1 -0
- package/dist/chunk-QFQVZOGA.js +2168 -0
- package/dist/chunk-QFQVZOGA.js.map +1 -0
- package/dist/chunk-QPKFPHOO.js +178 -0
- package/dist/chunk-QPKFPHOO.js.map +1 -0
- package/dist/chunk-QSVPYQPG.js +268 -0
- package/dist/chunk-QSVPYQPG.js.map +1 -0
- package/dist/chunk-QWUUMMIK.js +3045 -0
- package/dist/chunk-QWUUMMIK.js.map +1 -0
- package/dist/chunk-QY2BHY5O.js +2378 -0
- package/dist/chunk-QY2BHY5O.js.map +1 -0
- package/dist/chunk-SCHEKPYH.js +349 -0
- package/dist/chunk-SCHEKPYH.js.map +1 -0
- package/dist/chunk-SCU65EZI.js +15 -0
- package/dist/chunk-SCU65EZI.js.map +1 -0
- package/dist/chunk-T4WRIV2C.js +170 -0
- package/dist/chunk-T4WRIV2C.js.map +1 -0
- package/dist/chunk-TKO4HZCK.js +1852 -0
- package/dist/chunk-TKO4HZCK.js.map +1 -0
- package/dist/chunk-TP4FZJIZ.js +93 -0
- package/dist/chunk-TP4FZJIZ.js.map +1 -0
- package/dist/chunk-TPB3I2AC.js +403 -0
- package/dist/chunk-TPB3I2AC.js.map +1 -0
- package/dist/chunk-TVVVQQAK.js +1431 -0
- package/dist/chunk-TVVVQQAK.js.map +1 -0
- package/dist/chunk-U4PV25RD.js +14 -0
- package/dist/chunk-U4PV25RD.js.map +1 -0
- package/dist/chunk-UCYSTFZR.js +284 -0
- package/dist/chunk-UCYSTFZR.js.map +1 -0
- package/dist/chunk-UHGBNIOS.js +205 -0
- package/dist/chunk-UHGBNIOS.js.map +1 -0
- package/dist/chunk-UIYZ5T3I.js +108 -0
- package/dist/chunk-UIYZ5T3I.js.map +1 -0
- package/dist/chunk-UV2FO7J4.js +747 -0
- package/dist/chunk-UV2FO7J4.js.map +1 -0
- package/dist/chunk-UZB5KHKX.js +63 -0
- package/dist/chunk-UZB5KHKX.js.map +1 -0
- package/dist/chunk-V3RXWQIE.js +626 -0
- package/dist/chunk-V3RXWQIE.js.map +1 -0
- package/dist/chunk-V4YC4LUK.js +444 -0
- package/dist/chunk-V4YC4LUK.js.map +1 -0
- package/dist/chunk-VEWZZM3H.js +133 -0
- package/dist/chunk-VEWZZM3H.js.map +1 -0
- package/dist/chunk-WWIQTB2Y.js +98 -0
- package/dist/chunk-WWIQTB2Y.js.map +1 -0
- package/dist/chunk-X7XN6YU4.js +24 -0
- package/dist/chunk-X7XN6YU4.js.map +1 -0
- package/dist/chunk-XKECPATV.js +202 -0
- package/dist/chunk-XKECPATV.js.map +1 -0
- package/dist/chunk-XYIK4LF6.js +75 -0
- package/dist/chunk-XYIK4LF6.js.map +1 -0
- package/dist/chunk-Y27UJK6V.js +39 -0
- package/dist/chunk-Y27UJK6V.js.map +1 -0
- package/dist/chunk-Y4Z4I6WK.js +9 -0
- package/dist/chunk-Y4Z4I6WK.js.map +1 -0
- package/dist/chunk-YAPUAHAY.js +10761 -0
- package/dist/chunk-YAPUAHAY.js.map +1 -0
- package/dist/chunk-YAZNBMNF.js +92 -0
- package/dist/chunk-YAZNBMNF.js.map +1 -0
- package/dist/chunk-YCN4BVDK.js +66 -0
- package/dist/chunk-YCN4BVDK.js.map +1 -0
- package/dist/chunk-YNCQ7E4M.js +388 -0
- package/dist/chunk-YNCQ7E4M.js.map +1 -0
- package/dist/chunk-YNI4S5WT.js +143 -0
- package/dist/chunk-YNI4S5WT.js.map +1 -0
- package/dist/chunk-YRMVARQP.js +406 -0
- package/dist/chunk-YRMVARQP.js.map +1 -0
- package/dist/chunk-Z5AAYHUC.js +79 -0
- package/dist/chunk-Z5AAYHUC.js.map +1 -0
- package/dist/chunk-Z5LAYHGJ.js +15 -0
- package/dist/chunk-Z5LAYHGJ.js.map +1 -0
- package/dist/chunk-ZJLY4QSU.js +823 -0
- package/dist/chunk-ZJLY4QSU.js.map +1 -0
- package/dist/chunk-ZKYI7UVO.js +276 -0
- package/dist/chunk-ZKYI7UVO.js.map +1 -0
- package/dist/chunk-ZPKBYX2F.js +297 -0
- package/dist/chunk-ZPKBYX2F.js.map +1 -0
- package/dist/chunking.d.ts +48 -0
- package/dist/chunking.js +11 -0
- package/dist/chunking.js.map +1 -0
- package/dist/cli.d.ts +1162 -0
- package/dist/cli.js +7187 -0
- package/dist/cli.js.map +1 -0
- package/dist/commitment-ledger.d.ts +83 -0
- package/dist/commitment-ledger.js +19 -0
- package/dist/commitment-ledger.js.map +1 -0
- package/dist/compression-optimizer.d.ts +37 -0
- package/dist/compression-optimizer.js +13 -0
- package/dist/compression-optimizer.js.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/cue-anchors.d.ts +50 -0
- package/dist/cue-anchors.js +15 -0
- package/dist/cue-anchors.js.map +1 -0
- package/dist/dashboard-runtime.d.ts +46 -0
- package/dist/dashboard-runtime.js +10 -0
- package/dist/dashboard-runtime.js.map +1 -0
- package/dist/day-summary.d.ts +6 -0
- package/dist/day-summary.js +10 -0
- package/dist/day-summary.js.map +1 -0
- package/dist/delinearize.d.ts +34 -0
- package/dist/delinearize.js +11 -0
- package/dist/delinearize.js.map +1 -0
- package/dist/embedding-fallback.d.ts +22 -0
- package/dist/embedding-fallback.js +8 -0
- package/dist/embedding-fallback.js.map +1 -0
- package/dist/engine-P26JFSVY.js +19 -0
- package/dist/engine-P26JFSVY.js.map +1 -0
- package/dist/entity-retrieval.d.ts +23 -0
- package/dist/entity-retrieval.js +24 -0
- package/dist/entity-retrieval.js.map +1 -0
- package/dist/evals.d.ts +282 -0
- package/dist/evals.js +32 -0
- package/dist/evals.js.map +1 -0
- package/dist/explicit-capture.d.ts +60 -0
- package/dist/explicit-capture.js +23 -0
- package/dist/explicit-capture.js.map +1 -0
- package/dist/extraction.d.ts +141 -0
- package/dist/extraction.js +22 -0
- package/dist/extraction.js.map +1 -0
- package/dist/fallback-llm.d.ts +95 -0
- package/dist/fallback-llm.js +12 -0
- package/dist/fallback-llm.js.map +1 -0
- package/dist/graph-dashboard-diff.d.ts +12 -0
- package/dist/graph-dashboard-diff.js +8 -0
- package/dist/graph-dashboard-diff.js.map +1 -0
- package/dist/graph-dashboard-key.d.ts +5 -0
- package/dist/graph-dashboard-key.js +7 -0
- package/dist/graph-dashboard-key.js.map +1 -0
- package/dist/graph-dashboard-parser.d.ts +20 -0
- package/dist/graph-dashboard-parser.js +8 -0
- package/dist/graph-dashboard-parser.js.map +1 -0
- package/dist/graph.d.ts +157 -0
- package/dist/graph.js +27 -0
- package/dist/graph.js.map +1 -0
- package/dist/harmonic-retrieval.d.ts +27 -0
- package/dist/harmonic-retrieval.js +12 -0
- package/dist/harmonic-retrieval.js.map +1 -0
- package/dist/himem.d.ts +23 -0
- package/dist/himem.js +7 -0
- package/dist/himem.js.map +1 -0
- package/dist/hygiene.d.ts +24 -0
- package/dist/hygiene.js +9 -0
- package/dist/hygiene.js.map +1 -0
- package/dist/identity-continuity.d.ts +17 -0
- package/dist/identity-continuity.js +19 -0
- package/dist/identity-continuity.js.map +1 -0
- package/dist/importance.d.ts +25 -0
- package/dist/importance.js +11 -0
- package/dist/importance.js.map +1 -0
- package/dist/index.d.ts +923 -0
- package/dist/index.js +2512 -0
- package/dist/index.js.map +1 -0
- package/dist/intent.d.ts +8 -0
- package/dist/intent.js +13 -0
- package/dist/intent.js.map +1 -0
- package/dist/json-extract.d.ts +14 -0
- package/dist/json-extract.js +9 -0
- package/dist/json-extract.js.map +1 -0
- package/dist/json-store.d.ts +5 -0
- package/dist/json-store.js +11 -0
- package/dist/json-store.js.map +1 -0
- package/dist/legacy-hook-compat.d.ts +3 -0
- package/dist/legacy-hook-compat.js +35 -0
- package/dist/legacy-hook-compat.js.map +1 -0
- package/dist/lifecycle.d.ts +52 -0
- package/dist/lifecycle.js +21 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/local-llm.d.ts +154 -0
- package/dist/local-llm.js +10 -0
- package/dist/local-llm.js.map +1 -0
- package/dist/logger.d.ts +15 -0
- package/dist/logger.js +9 -0
- package/dist/logger.js.map +1 -0
- package/dist/memory-action-policy.d.ts +13 -0
- package/dist/memory-action-policy.js +7 -0
- package/dist/memory-action-policy.js.map +1 -0
- package/dist/memory-cache.d.ts +35 -0
- package/dist/memory-cache.js +37 -0
- package/dist/memory-cache.js.map +1 -0
- package/dist/memory-lifecycle-ledger-utils.d.ts +13 -0
- package/dist/memory-lifecycle-ledger-utils.js +23 -0
- package/dist/memory-lifecycle-ledger-utils.js.map +1 -0
- package/dist/memory-projection-format.d.ts +4 -0
- package/dist/memory-projection-format.js +9 -0
- package/dist/memory-projection-format.js.map +1 -0
- package/dist/memory-projection-store-NxMkbocT.d.ts +221 -0
- package/dist/memory-projection-store.d.ts +3 -0
- package/dist/memory-projection-store.js +31 -0
- package/dist/memory-projection-store.js.map +1 -0
- package/dist/model-registry.d.ts +60 -0
- package/dist/model-registry.js +8 -0
- package/dist/model-registry.js.map +1 -0
- package/dist/native-knowledge.d.ts +94 -0
- package/dist/native-knowledge.js +26 -0
- package/dist/native-knowledge.js.map +1 -0
- package/dist/negative.d.ts +26 -0
- package/dist/negative.js +8 -0
- package/dist/negative.js.map +1 -0
- package/dist/objective-state-writers.d.ts +22 -0
- package/dist/objective-state-writers.js +313 -0
- package/dist/objective-state-writers.js.map +1 -0
- package/dist/objective-state.d.ts +75 -0
- package/dist/objective-state.js +17 -0
- package/dist/objective-state.js.map +1 -0
- package/dist/openai-chat-compat.d.ts +13 -0
- package/dist/openai-chat-compat.js +11 -0
- package/dist/openai-chat-compat.js.map +1 -0
- package/dist/operator-toolkit.d.ts +304 -0
- package/dist/operator-toolkit.js +41 -0
- package/dist/operator-toolkit.js.map +1 -0
- package/dist/opik-exporter.d.ts +72 -0
- package/dist/opik-exporter.js +361 -0
- package/dist/opik-exporter.js.map +1 -0
- package/dist/orchestrator-zTa-Qo-1.d.ts +1104 -0
- package/dist/orchestrator.d.ts +21 -0
- package/dist/orchestrator.js +145 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/policy-runtime.d.ts +37 -0
- package/dist/policy-runtime.js +13 -0
- package/dist/policy-runtime.js.map +1 -0
- package/dist/port-C1GZFv8h.d.ts +41 -0
- package/dist/profiling.d.ts +80 -0
- package/dist/profiling.js +10 -0
- package/dist/profiling.js.map +1 -0
- package/dist/qmd-recall-cache.d.ts +29 -0
- package/dist/qmd-recall-cache.js +13 -0
- package/dist/qmd-recall-cache.js.map +1 -0
- package/dist/qmd.d.ts +105 -0
- package/dist/qmd.js +13 -0
- package/dist/qmd.js.map +1 -0
- package/dist/recall-qos.d.ts +33 -0
- package/dist/recall-qos.js +10 -0
- package/dist/recall-qos.js.map +1 -0
- package/dist/recall-query-policy.d.ts +20 -0
- package/dist/recall-query-policy.js +11 -0
- package/dist/recall-query-policy.js.map +1 -0
- package/dist/recall-state.d.ts +113 -0
- package/dist/recall-state.js +12 -0
- package/dist/recall-state.js.map +1 -0
- package/dist/recall-tokenization.d.ts +4 -0
- package/dist/recall-tokenization.js +9 -0
- package/dist/recall-tokenization.js.map +1 -0
- package/dist/reconstruct.d.ts +16 -0
- package/dist/reconstruct.js +7 -0
- package/dist/reconstruct.js.map +1 -0
- package/dist/release-changelog.d.ts +7 -0
- package/dist/release-changelog.js +30 -0
- package/dist/release-changelog.js.map +1 -0
- package/dist/relevance.d.ts +18 -0
- package/dist/relevance.js +8 -0
- package/dist/relevance.js.map +1 -0
- package/dist/rerank.d.ts +57 -0
- package/dist/rerank.js +11 -0
- package/dist/rerank.js.map +1 -0
- package/dist/resolve-provider-secret.d.ts +16 -0
- package/dist/resolve-provider-secret.js +11 -0
- package/dist/resolve-provider-secret.js.map +1 -0
- package/dist/resume-bundles.d.ts +66 -0
- package/dist/resume-bundles.js +27 -0
- package/dist/resume-bundles.js.map +1 -0
- package/dist/retrieval-agents.d.ts +129 -0
- package/dist/retrieval-agents.js +23 -0
- package/dist/retrieval-agents.js.map +1 -0
- package/dist/retrieval.d.ts +19 -0
- package/dist/retrieval.js +10 -0
- package/dist/retrieval.js.map +1 -0
- package/dist/sanitize.d.ts +9 -0
- package/dist/sanitize.js +9 -0
- package/dist/sanitize.js.map +1 -0
- package/dist/schemas.d.ts +688 -0
- package/dist/schemas.js +51 -0
- package/dist/schemas.js.map +1 -0
- package/dist/sdk-compat.d.ts +21 -0
- package/dist/sdk-compat.js +28 -0
- package/dist/sdk-compat.js.map +1 -0
- package/dist/semantic-consolidation.d.ts +42 -0
- package/dist/semantic-consolidation.js +12 -0
- package/dist/semantic-consolidation.js.map +1 -0
- package/dist/semantic-rule-promotion.d.ts +28 -0
- package/dist/semantic-rule-promotion.js +17 -0
- package/dist/semantic-rule-promotion.js.map +1 -0
- package/dist/semantic-rule-verifier.d.ts +19 -0
- package/dist/semantic-rule-verifier.js +18 -0
- package/dist/semantic-rule-verifier.js.map +1 -0
- package/dist/session-integrity.d.ts +67 -0
- package/dist/session-integrity.js +11 -0
- package/dist/session-integrity.js.map +1 -0
- package/dist/session-observer-bands.d.ts +6 -0
- package/dist/session-observer-bands.js +9 -0
- package/dist/session-observer-bands.js.map +1 -0
- package/dist/session-observer-state.d.ts +40 -0
- package/dist/session-observer-state.js +11 -0
- package/dist/session-observer-state.js.map +1 -0
- package/dist/signal.d.ts +6 -0
- package/dist/signal.js +9 -0
- package/dist/signal.js.map +1 -0
- package/dist/storage.d.ts +453 -0
- package/dist/storage.js +24 -0
- package/dist/storage.js.map +1 -0
- package/dist/store-contract.d.ts +10 -0
- package/dist/store-contract.js +21 -0
- package/dist/store-contract.js.map +1 -0
- package/dist/summarizer.d.ts +35 -0
- package/dist/summarizer.js +17 -0
- package/dist/summarizer.js.map +1 -0
- package/dist/summary-snapshot.d.ts +8 -0
- package/dist/summary-snapshot.js +13 -0
- package/dist/summary-snapshot.js.map +1 -0
- package/dist/temporal-index.d.ts +139 -0
- package/dist/temporal-index.js +29 -0
- package/dist/temporal-index.js.map +1 -0
- package/dist/threading.d.ts +62 -0
- package/dist/threading.js +8 -0
- package/dist/threading.js.map +1 -0
- package/dist/tier-migration.d.ts +44 -0
- package/dist/tier-migration.js +7 -0
- package/dist/tier-migration.js.map +1 -0
- package/dist/tier-routing.d.ts +21 -0
- package/dist/tier-routing.js +10 -0
- package/dist/tier-routing.js.map +1 -0
- package/dist/tmt.d.ts +79 -0
- package/dist/tmt.js +29 -0
- package/dist/tmt.js.map +1 -0
- package/dist/tokens.d.ts +24 -0
- package/dist/tokens.js +21 -0
- package/dist/tokens.js.map +1 -0
- package/dist/topics.d.ts +29 -0
- package/dist/topics.js +9 -0
- package/dist/topics.js.map +1 -0
- package/dist/transcript.d.ts +171 -0
- package/dist/transcript.js +9 -0
- package/dist/transcript.js.map +1 -0
- package/dist/trust-zones.d.ts +170 -0
- package/dist/trust-zones.js +32 -0
- package/dist/trust-zones.js.map +1 -0
- package/dist/types.d.ts +1243 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/utility-learner.d.ts +59 -0
- package/dist/utility-learner.js +17 -0
- package/dist/utility-learner.js.map +1 -0
- package/dist/utility-runtime.d.ts +21 -0
- package/dist/utility-runtime.js +16 -0
- package/dist/utility-runtime.js.map +1 -0
- package/dist/utility-telemetry.d.ts +68 -0
- package/dist/utility-telemetry.js +17 -0
- package/dist/utility-telemetry.js.map +1 -0
- package/dist/verified-recall.d.ts +17 -0
- package/dist/verified-recall.js +19 -0
- package/dist/verified-recall.js.map +1 -0
- package/dist/version-utils.d.ts +4 -0
- package/dist/version-utils.js +7 -0
- package/dist/version-utils.js.map +1 -0
- package/dist/work-product-ledger.d.ts +65 -0
- package/dist/work-product-ledger.js +18 -0
- package/dist/work-product-ledger.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeSessionIntegrity
|
|
3
|
+
} from "./chunk-YRMVARQP.js";
|
|
4
|
+
import {
|
|
5
|
+
log
|
|
6
|
+
} from "./chunk-KWBU5S5U.js";
|
|
7
|
+
|
|
8
|
+
// src/transcript.ts
|
|
9
|
+
import { appendFile, mkdir, readdir, readFile, stat, unlink, writeFile } from "fs/promises";
|
|
10
|
+
import path from "path";
|
|
11
|
+
var TranscriptManager = class _TranscriptManager {
|
|
12
|
+
transcriptsDir;
|
|
13
|
+
checkpointPath;
|
|
14
|
+
stateDir;
|
|
15
|
+
toolUsageDir;
|
|
16
|
+
config;
|
|
17
|
+
sessionFootprintCache = /* @__PURE__ */ new Map();
|
|
18
|
+
/** Default checkpoint TTL in hours */
|
|
19
|
+
static DEFAULT_CHECKPOINT_TTL_HOURS = 24;
|
|
20
|
+
/** Approximate characters per token for rough estimation */
|
|
21
|
+
static CHARS_PER_TOKEN = 4;
|
|
22
|
+
constructor(config) {
|
|
23
|
+
this.config = config;
|
|
24
|
+
this.transcriptsDir = path.join(config.memoryDir, "transcripts");
|
|
25
|
+
this.stateDir = path.join(config.memoryDir, "state");
|
|
26
|
+
this.checkpointPath = path.join(this.stateDir, "checkpoint.json");
|
|
27
|
+
this.toolUsageDir = path.join(this.stateDir, "tool-usage");
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Parse a sessionKey to extract channel type and ID.
|
|
31
|
+
*
|
|
32
|
+
* SessionKey patterns:
|
|
33
|
+
* - agent:<agent-id>:main → type="main", id="default"
|
|
34
|
+
* - agent:<agent-id>:discord:channel:<channel-id> → type="discord", id="<channel-id>"
|
|
35
|
+
* - agent:<agent-id>:cron:<job-id> → type="cron", id="<job-id>"
|
|
36
|
+
* - agent:<agent-id>:slack:channel:<channel-id> → type="slack", id="<channel-id>"
|
|
37
|
+
*
|
|
38
|
+
* @returns Object with dir (channel type/channel id) and file (YYYY-MM-DD.jsonl)
|
|
39
|
+
*/
|
|
40
|
+
getTranscriptPath(sessionKey) {
|
|
41
|
+
const parts = sessionKey.split(":");
|
|
42
|
+
let channelType = "other";
|
|
43
|
+
let channelId = "default";
|
|
44
|
+
if (parts.length >= 3) {
|
|
45
|
+
channelType = parts[2];
|
|
46
|
+
if (channelType === "main") {
|
|
47
|
+
channelId = "default";
|
|
48
|
+
} else if (channelType === "discord" && parts.length >= 5 && parts[3] === "channel") {
|
|
49
|
+
channelId = parts[4];
|
|
50
|
+
} else if (channelType === "slack" && parts.length >= 5 && parts[3] === "channel") {
|
|
51
|
+
channelId = parts[4];
|
|
52
|
+
} else if (channelType === "cron" && parts.length >= 4) {
|
|
53
|
+
channelId = parts[3];
|
|
54
|
+
} else if (parts.length >= 4) {
|
|
55
|
+
channelId = parts[3];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
59
|
+
return {
|
|
60
|
+
dir: path.join(channelType, channelId),
|
|
61
|
+
file: `${today}.jsonl`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Initialize the transcript manager by ensuring directories exist.
|
|
66
|
+
*/
|
|
67
|
+
async initialize() {
|
|
68
|
+
await mkdir(this.transcriptsDir, { recursive: true });
|
|
69
|
+
await mkdir(this.stateDir, { recursive: true });
|
|
70
|
+
await mkdir(this.toolUsageDir, { recursive: true });
|
|
71
|
+
log.info("transcript manager initialized");
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Best-effort list of sessionKeys that have transcript files on disk.
|
|
75
|
+
* This is used by cron-style tooling (hourly summaries, conversation indexing)
|
|
76
|
+
* to iterate across "active" sessions.
|
|
77
|
+
*/
|
|
78
|
+
async listSessionKeys() {
|
|
79
|
+
const transcriptDir = this.transcriptsDir;
|
|
80
|
+
const sessionKeys = /* @__PURE__ */ new Set();
|
|
81
|
+
try {
|
|
82
|
+
const typeEntries = await readdir(transcriptDir, { withFileTypes: true });
|
|
83
|
+
for (const typeEnt of typeEntries) {
|
|
84
|
+
if (!typeEnt.isDirectory()) continue;
|
|
85
|
+
const typeDir = path.join(transcriptDir, typeEnt.name);
|
|
86
|
+
const idEntries = await readdir(typeDir, { withFileTypes: true });
|
|
87
|
+
for (const idEnt of idEntries) {
|
|
88
|
+
if (!idEnt.isDirectory()) continue;
|
|
89
|
+
const chanDir = path.join(typeDir, idEnt.name);
|
|
90
|
+
const files = (await readdir(chanDir)).filter((f) => f.endsWith(".jsonl")).sort();
|
|
91
|
+
const last = files[files.length - 1];
|
|
92
|
+
if (!last) continue;
|
|
93
|
+
try {
|
|
94
|
+
const raw = await readFile(path.join(chanDir, last), "utf-8");
|
|
95
|
+
const firstLine = raw.split("\n").find((l) => l.trim().length > 0);
|
|
96
|
+
if (!firstLine) continue;
|
|
97
|
+
const entry = JSON.parse(firstLine);
|
|
98
|
+
if (typeof entry.sessionKey === "string" && entry.sessionKey.length > 0) {
|
|
99
|
+
sessionKeys.add(entry.sessionKey);
|
|
100
|
+
}
|
|
101
|
+
} catch {
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} catch {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
return Array.from(sessionKeys);
|
|
109
|
+
}
|
|
110
|
+
getToolUsagePath(sessionKey) {
|
|
111
|
+
const p = this.getTranscriptPath(sessionKey);
|
|
112
|
+
return { dir: p.dir, file: p.file };
|
|
113
|
+
}
|
|
114
|
+
async appendToolUse(entry) {
|
|
115
|
+
const { dir, file } = this.getToolUsagePath(entry.sessionKey);
|
|
116
|
+
const channelDir = path.join(this.toolUsageDir, dir);
|
|
117
|
+
await mkdir(channelDir, { recursive: true });
|
|
118
|
+
const filePath = path.join(channelDir, file);
|
|
119
|
+
await appendFile(filePath, JSON.stringify(entry) + "\n", "utf-8");
|
|
120
|
+
}
|
|
121
|
+
async readToolUse(sessionKey, startTime, endTime) {
|
|
122
|
+
const { dir } = this.getToolUsagePath(sessionKey);
|
|
123
|
+
const channelDir = path.join(this.toolUsageDir, dir);
|
|
124
|
+
try {
|
|
125
|
+
const files = await readdir(channelDir);
|
|
126
|
+
const out = [];
|
|
127
|
+
for (const file of files) {
|
|
128
|
+
if (!file.endsWith(".jsonl")) continue;
|
|
129
|
+
const fp = path.join(channelDir, file);
|
|
130
|
+
const raw = await readFile(fp, "utf-8");
|
|
131
|
+
for (const line of raw.split("\n")) {
|
|
132
|
+
if (!line.trim()) continue;
|
|
133
|
+
try {
|
|
134
|
+
const obj = JSON.parse(line);
|
|
135
|
+
const ts = new Date(String(obj.timestamp ?? "")).getTime();
|
|
136
|
+
if (!Number.isFinite(ts)) continue;
|
|
137
|
+
if (ts >= startTime.getTime() && ts < endTime.getTime()) {
|
|
138
|
+
if (typeof obj.tool === "string" && typeof obj.sessionKey === "string") {
|
|
139
|
+
out.push({ timestamp: obj.timestamp, sessionKey: obj.sessionKey, tool: obj.tool });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
} catch {
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
} catch {
|
|
148
|
+
return [];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async estimateSessionFootprint(sessionKey) {
|
|
152
|
+
const { dir } = this.getTranscriptPath(sessionKey);
|
|
153
|
+
const channelDir = path.join(this.transcriptsDir, dir);
|
|
154
|
+
let bytes = 0;
|
|
155
|
+
try {
|
|
156
|
+
const files = (await readdir(channelDir)).filter((file) => file.endsWith(".jsonl")).sort();
|
|
157
|
+
const cached = this.sessionFootprintCache.get(sessionKey);
|
|
158
|
+
if (!cached) {
|
|
159
|
+
const fileBytes = /* @__PURE__ */ new Map();
|
|
160
|
+
const fileSizes = /* @__PURE__ */ new Map();
|
|
161
|
+
for (const file of files) {
|
|
162
|
+
try {
|
|
163
|
+
const fullPath = path.join(channelDir, file);
|
|
164
|
+
const fileInfo = await stat(fullPath);
|
|
165
|
+
const sessionBytes = await this.estimateSessionBytesInFile(
|
|
166
|
+
fullPath,
|
|
167
|
+
sessionKey
|
|
168
|
+
);
|
|
169
|
+
fileBytes.set(file, sessionBytes);
|
|
170
|
+
fileSizes.set(file, Math.max(0, fileInfo.size));
|
|
171
|
+
bytes += sessionBytes;
|
|
172
|
+
} catch {
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
this.sessionFootprintCache.set(sessionKey, { totalBytes: bytes, fileBytes, fileSizes });
|
|
176
|
+
} else {
|
|
177
|
+
bytes = cached.totalBytes;
|
|
178
|
+
const seen = new Set(files);
|
|
179
|
+
for (const [cachedFile, cachedSessionBytes] of cached.fileBytes.entries()) {
|
|
180
|
+
if (!seen.has(cachedFile)) {
|
|
181
|
+
bytes -= cachedSessionBytes;
|
|
182
|
+
cached.fileBytes.delete(cachedFile);
|
|
183
|
+
cached.fileSizes.delete(cachedFile);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
for (const file of files) {
|
|
187
|
+
if (cached.fileBytes.has(file)) continue;
|
|
188
|
+
try {
|
|
189
|
+
const fullPath = path.join(channelDir, file);
|
|
190
|
+
const fileInfo = await stat(fullPath);
|
|
191
|
+
const sessionBytes = await this.estimateSessionBytesInFile(fullPath, sessionKey);
|
|
192
|
+
cached.fileBytes.set(file, sessionBytes);
|
|
193
|
+
cached.fileSizes.set(file, Math.max(0, fileInfo.size));
|
|
194
|
+
bytes += sessionBytes;
|
|
195
|
+
} catch {
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const newestFile = files[files.length - 1];
|
|
199
|
+
if (newestFile) {
|
|
200
|
+
try {
|
|
201
|
+
const newestPath = path.join(channelDir, newestFile);
|
|
202
|
+
const fileInfo = await stat(newestPath);
|
|
203
|
+
const size = Math.max(0, fileInfo.size);
|
|
204
|
+
const previousSessionBytes = cached.fileBytes.get(newestFile) ?? 0;
|
|
205
|
+
const previousSize = cached.fileSizes.get(newestFile) ?? -1;
|
|
206
|
+
if (size !== previousSize) {
|
|
207
|
+
const sessionBytes = await this.estimateSessionBytesInFile(newestPath, sessionKey);
|
|
208
|
+
cached.fileBytes.set(newestFile, sessionBytes);
|
|
209
|
+
cached.fileSizes.set(newestFile, size);
|
|
210
|
+
bytes += sessionBytes - previousSessionBytes;
|
|
211
|
+
}
|
|
212
|
+
} catch {
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (bytes < 0) bytes = 0;
|
|
216
|
+
cached.totalBytes = bytes;
|
|
217
|
+
}
|
|
218
|
+
} catch {
|
|
219
|
+
this.sessionFootprintCache.delete(sessionKey);
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
bytes,
|
|
223
|
+
tokens: Math.floor(bytes / _TranscriptManager.CHARS_PER_TOKEN)
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
async estimateSessionBytesInFile(filePath, sessionKey) {
|
|
227
|
+
try {
|
|
228
|
+
const raw = await readFile(filePath, "utf-8");
|
|
229
|
+
let total = 0;
|
|
230
|
+
for (const line of raw.split("\n")) {
|
|
231
|
+
if (!line.trim()) continue;
|
|
232
|
+
try {
|
|
233
|
+
const parsed = JSON.parse(line);
|
|
234
|
+
if (parsed.sessionKey === sessionKey) {
|
|
235
|
+
total += Buffer.byteLength(`${line}
|
|
236
|
+
`, "utf-8");
|
|
237
|
+
}
|
|
238
|
+
} catch {
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return total;
|
|
242
|
+
} catch {
|
|
243
|
+
return 0;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Check if a file is a legacy flat transcript file (YYYY-MM-DD.jsonl format).
|
|
248
|
+
*/
|
|
249
|
+
isLegacyTranscriptFile(filename) {
|
|
250
|
+
return /^\d{4}-\d{2}-\d{2}\.jsonl$/.test(filename);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Append a turn to the appropriate transcript file.
|
|
254
|
+
* Files are stored hierarchically: transcripts/{channelType}/{channelId}.jsonl
|
|
255
|
+
*
|
|
256
|
+
* Skips channel types in config.transcriptSkipChannelTypes (e.g., "cron").
|
|
257
|
+
*/
|
|
258
|
+
async append(entry) {
|
|
259
|
+
try {
|
|
260
|
+
const { dir, file } = this.getTranscriptPath(entry.sessionKey);
|
|
261
|
+
const channelType = dir.split(path.sep)[0] ?? dir;
|
|
262
|
+
if (this.config.transcriptSkipChannelTypes.includes(channelType)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const channelDir = path.join(this.transcriptsDir, dir);
|
|
266
|
+
const filePath = path.join(channelDir, file);
|
|
267
|
+
await mkdir(channelDir, { recursive: true });
|
|
268
|
+
const line = JSON.stringify(entry) + "\n";
|
|
269
|
+
await appendFile(filePath, line, "utf-8");
|
|
270
|
+
log.debug(`appended transcript entry for ${entry.sessionKey}: ${entry.turnId}`);
|
|
271
|
+
} catch (err) {
|
|
272
|
+
log.error("failed to append transcript entry:", err);
|
|
273
|
+
throw err;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get all transcript files from the hierarchical directory structure.
|
|
278
|
+
* Recursively finds all .jsonl files in transcripts/{channelType}/{channelId}/ subdirectories.
|
|
279
|
+
*/
|
|
280
|
+
async getAllTranscriptFiles() {
|
|
281
|
+
const files = [];
|
|
282
|
+
try {
|
|
283
|
+
const entries = await readdir(this.transcriptsDir, { withFileTypes: true });
|
|
284
|
+
for (const entry of entries) {
|
|
285
|
+
if (entry.isDirectory()) {
|
|
286
|
+
const channelTypeDir = path.join(this.transcriptsDir, entry.name);
|
|
287
|
+
try {
|
|
288
|
+
const channelTypeEntries = await readdir(channelTypeDir, { withFileTypes: true });
|
|
289
|
+
for (const channelTypeEntry of channelTypeEntries) {
|
|
290
|
+
if (channelTypeEntry.isDirectory()) {
|
|
291
|
+
const channelDir = path.join(channelTypeDir, channelTypeEntry.name);
|
|
292
|
+
try {
|
|
293
|
+
const channelFiles = await readdir(channelDir);
|
|
294
|
+
for (const file of channelFiles) {
|
|
295
|
+
if (file.endsWith(".jsonl")) {
|
|
296
|
+
files.push(path.join(entry.name, channelTypeEntry.name, file));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
} catch {
|
|
300
|
+
}
|
|
301
|
+
} else if (channelTypeEntry.isFile() && channelTypeEntry.name.endsWith(".jsonl")) {
|
|
302
|
+
files.push(path.join(entry.name, channelTypeEntry.name));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
} catch {
|
|
306
|
+
}
|
|
307
|
+
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
308
|
+
files.push(entry.name);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
} catch {
|
|
312
|
+
}
|
|
313
|
+
return files;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Read transcript entries for a date range.
|
|
317
|
+
* Returns entries within the time range, optionally filtered by sessionKey.
|
|
318
|
+
* Reads from all channel subdirectories in the hierarchical structure.
|
|
319
|
+
*/
|
|
320
|
+
async readRange(startTime, endTime, sessionKey) {
|
|
321
|
+
const start = new Date(startTime);
|
|
322
|
+
const end = new Date(endTime);
|
|
323
|
+
const entries = [];
|
|
324
|
+
try {
|
|
325
|
+
const transcriptFiles = await this.getAllTranscriptFiles();
|
|
326
|
+
for (const relativePath of transcriptFiles) {
|
|
327
|
+
const filePath = path.join(this.transcriptsDir, relativePath);
|
|
328
|
+
try {
|
|
329
|
+
const content = await readFile(filePath, "utf-8");
|
|
330
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
331
|
+
for (const line of lines) {
|
|
332
|
+
try {
|
|
333
|
+
const entry = JSON.parse(line);
|
|
334
|
+
const entryTime = new Date(entry.timestamp);
|
|
335
|
+
if (entryTime >= start && entryTime <= end) {
|
|
336
|
+
if (!sessionKey || entry.sessionKey === sessionKey) {
|
|
337
|
+
entries.push(entry);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
} catch {
|
|
341
|
+
log.debug(`skipped malformed transcript line in ${relativePath}`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
} catch {
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
entries.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
348
|
+
log.debug(`read ${entries.length} transcript entries from ${transcriptFiles.length} file(s)`);
|
|
349
|
+
return entries;
|
|
350
|
+
} catch (err) {
|
|
351
|
+
log.error("failed to read transcript range:", err);
|
|
352
|
+
return [];
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Read the last N hours of transcript.
|
|
357
|
+
*
|
|
358
|
+
* Fast path: when sessionKey is given, reads only the 1-2 daily files for that
|
|
359
|
+
* specific channel instead of scanning all 95+ transcript files across all channels.
|
|
360
|
+
*/
|
|
361
|
+
async readRecent(hours, sessionKey) {
|
|
362
|
+
const end = /* @__PURE__ */ new Date();
|
|
363
|
+
const start = new Date(end.getTime() - hours * 60 * 60 * 1e3);
|
|
364
|
+
if (sessionKey) {
|
|
365
|
+
return this.readRecentForSession(start, end, sessionKey);
|
|
366
|
+
}
|
|
367
|
+
return this.readRange(start.toISOString(), end.toISOString(), void 0);
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Optimized read for a specific session: only looks in that session's channel
|
|
371
|
+
* directory and only reads files whose date falls within the lookback window.
|
|
372
|
+
*/
|
|
373
|
+
async readRecentForSession(start, end, sessionKey) {
|
|
374
|
+
const { dir } = this.getTranscriptPath(sessionKey);
|
|
375
|
+
const channelDir = path.join(this.transcriptsDir, dir);
|
|
376
|
+
const dateStrings = /* @__PURE__ */ new Set();
|
|
377
|
+
const cursor = new Date(start);
|
|
378
|
+
while (cursor <= end) {
|
|
379
|
+
dateStrings.add(cursor.toISOString().slice(0, 10));
|
|
380
|
+
cursor.setDate(cursor.getDate() + 1);
|
|
381
|
+
}
|
|
382
|
+
dateStrings.add(end.toISOString().slice(0, 10));
|
|
383
|
+
const entries = [];
|
|
384
|
+
let files;
|
|
385
|
+
try {
|
|
386
|
+
files = (await readdir(channelDir)).filter((f) => f.endsWith(".jsonl"));
|
|
387
|
+
} catch {
|
|
388
|
+
return [];
|
|
389
|
+
}
|
|
390
|
+
for (const file of files) {
|
|
391
|
+
const dateStr = file.slice(0, 10);
|
|
392
|
+
if (!dateStrings.has(dateStr)) continue;
|
|
393
|
+
try {
|
|
394
|
+
const content = await readFile(path.join(channelDir, file), "utf-8");
|
|
395
|
+
for (const line of content.split("\n")) {
|
|
396
|
+
if (!line.trim()) continue;
|
|
397
|
+
try {
|
|
398
|
+
const entry = JSON.parse(line);
|
|
399
|
+
const ts = new Date(entry.timestamp);
|
|
400
|
+
if (ts >= start && ts <= end && entry.sessionKey === sessionKey) {
|
|
401
|
+
entries.push(entry);
|
|
402
|
+
}
|
|
403
|
+
} catch {
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
} catch {
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
entries.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
410
|
+
log.debug(`readRecentForSession: ${entries.length} entries from ${files.length} file(s) in ${dir}`);
|
|
411
|
+
return entries;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Cleanup old transcript entries that are older than retentionDays.
|
|
415
|
+
* For hierarchical structure, reads each file and rewrites without old entries.
|
|
416
|
+
* Legacy flat files are deleted if their date is older than retentionDays.
|
|
417
|
+
* Returns the number of files processed (cleaned or deleted).
|
|
418
|
+
*/
|
|
419
|
+
async cleanup(retentionDays) {
|
|
420
|
+
if (retentionDays <= 0) {
|
|
421
|
+
log.warn("cleanup called with invalid retentionDays:", retentionDays);
|
|
422
|
+
return 0;
|
|
423
|
+
}
|
|
424
|
+
const cutoff = /* @__PURE__ */ new Date();
|
|
425
|
+
cutoff.setDate(cutoff.getDate() - retentionDays);
|
|
426
|
+
cutoff.setHours(0, 0, 0, 0);
|
|
427
|
+
let processed = 0;
|
|
428
|
+
try {
|
|
429
|
+
const entries = await readdir(this.transcriptsDir, { withFileTypes: true });
|
|
430
|
+
for (const entry of entries) {
|
|
431
|
+
if (entry.isDirectory()) {
|
|
432
|
+
const channelTypeDir = path.join(this.transcriptsDir, entry.name);
|
|
433
|
+
try {
|
|
434
|
+
const channelTypeEntries = await readdir(channelTypeDir, { withFileTypes: true });
|
|
435
|
+
for (const channelTypeEntry of channelTypeEntries) {
|
|
436
|
+
if (channelTypeEntry.isDirectory()) {
|
|
437
|
+
const channelDir = path.join(channelTypeDir, channelTypeEntry.name);
|
|
438
|
+
try {
|
|
439
|
+
const channelFiles = await readdir(channelDir);
|
|
440
|
+
for (const file of channelFiles) {
|
|
441
|
+
if (!file.endsWith(".jsonl")) continue;
|
|
442
|
+
const filePath = path.join(channelDir, file);
|
|
443
|
+
if (this.isLegacyTranscriptFile(file)) {
|
|
444
|
+
const dateStr = file.slice(0, 10);
|
|
445
|
+
const fileDate = new Date(dateStr);
|
|
446
|
+
if (!isNaN(fileDate.getTime()) && fileDate < cutoff) {
|
|
447
|
+
try {
|
|
448
|
+
await unlink(filePath);
|
|
449
|
+
processed++;
|
|
450
|
+
log.debug(`deleted old daily transcript file: ${entry.name}/${channelTypeEntry.name}/${file}`);
|
|
451
|
+
} catch (err) {
|
|
452
|
+
log.error(`failed to delete transcript file ${filePath}:`, err);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
} else {
|
|
456
|
+
const cleaned = await this.cleanupTranscriptFile(filePath, cutoff);
|
|
457
|
+
if (cleaned) {
|
|
458
|
+
processed++;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
} catch (err) {
|
|
463
|
+
log.debug(`failed to process channel directory ${entry.name}/${channelTypeEntry.name}:`, err);
|
|
464
|
+
}
|
|
465
|
+
} else if (channelTypeEntry.isFile() && channelTypeEntry.name.endsWith(".jsonl")) {
|
|
466
|
+
const filePath = path.join(channelTypeDir, channelTypeEntry.name);
|
|
467
|
+
const cleaned = await this.cleanupTranscriptFile(filePath, cutoff);
|
|
468
|
+
if (cleaned) {
|
|
469
|
+
processed++;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
} catch (err) {
|
|
474
|
+
log.debug(`failed to process channel type directory ${entry.name}:`, err);
|
|
475
|
+
}
|
|
476
|
+
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
477
|
+
if (this.isLegacyTranscriptFile(entry.name)) {
|
|
478
|
+
const dateStr = entry.name.slice(0, 10);
|
|
479
|
+
const fileDate = new Date(dateStr);
|
|
480
|
+
if (!isNaN(fileDate.getTime()) && fileDate < cutoff) {
|
|
481
|
+
const filePath = path.join(this.transcriptsDir, entry.name);
|
|
482
|
+
try {
|
|
483
|
+
await unlink(filePath);
|
|
484
|
+
processed++;
|
|
485
|
+
log.debug(`deleted old legacy transcript file: ${entry.name}`);
|
|
486
|
+
} catch (err) {
|
|
487
|
+
log.error(`failed to delete legacy transcript file ${entry.name}:`, err);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
if (processed > 0) {
|
|
494
|
+
log.info(`cleaned up ${processed} transcript file(s) older than ${retentionDays} days`);
|
|
495
|
+
}
|
|
496
|
+
return processed;
|
|
497
|
+
} catch (err) {
|
|
498
|
+
log.error("failed to cleanup old transcripts:", err);
|
|
499
|
+
return 0;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Clean up old entries from a single transcript file.
|
|
504
|
+
* Reads the file, filters out entries older than cutoff, and rewrites if needed.
|
|
505
|
+
* Returns true if the file was processed (cleaned or deleted).
|
|
506
|
+
*/
|
|
507
|
+
async cleanupTranscriptFile(filePath, cutoff) {
|
|
508
|
+
try {
|
|
509
|
+
const content = await readFile(filePath, "utf-8");
|
|
510
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
511
|
+
const validLines = [];
|
|
512
|
+
let hasOldEntries = false;
|
|
513
|
+
for (const line of lines) {
|
|
514
|
+
try {
|
|
515
|
+
const entry = JSON.parse(line);
|
|
516
|
+
const entryTime = new Date(entry.timestamp);
|
|
517
|
+
if (entryTime >= cutoff) {
|
|
518
|
+
validLines.push(line);
|
|
519
|
+
} else {
|
|
520
|
+
hasOldEntries = true;
|
|
521
|
+
}
|
|
522
|
+
} catch {
|
|
523
|
+
validLines.push(line);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (validLines.length === 0) {
|
|
527
|
+
try {
|
|
528
|
+
await unlink(filePath);
|
|
529
|
+
log.debug(`deleted empty transcript file: ${filePath}`);
|
|
530
|
+
return true;
|
|
531
|
+
} catch (err) {
|
|
532
|
+
log.error(`failed to delete empty transcript file ${filePath}:`, err);
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (hasOldEntries) {
|
|
537
|
+
await writeFile(filePath, validLines.join("\n") + "\n", "utf-8");
|
|
538
|
+
log.debug(`cleaned old entries from transcript file: ${filePath}`);
|
|
539
|
+
return true;
|
|
540
|
+
}
|
|
541
|
+
return false;
|
|
542
|
+
} catch (err) {
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Save a checkpoint to preserve conversation context.
|
|
548
|
+
* Called when compaction is detected.
|
|
549
|
+
*/
|
|
550
|
+
async saveCheckpoint(checkpoint) {
|
|
551
|
+
try {
|
|
552
|
+
await writeFile(this.checkpointPath, JSON.stringify(checkpoint, null, 2), "utf-8");
|
|
553
|
+
log.info(`saved checkpoint for session ${checkpoint.sessionKey} with ${checkpoint.turns.length} turn(s)`);
|
|
554
|
+
} catch (err) {
|
|
555
|
+
log.error("failed to save checkpoint:", err);
|
|
556
|
+
throw err;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Load a checkpoint if one exists and is not expired.
|
|
561
|
+
* Returns null if no checkpoint exists or if it has expired.
|
|
562
|
+
*/
|
|
563
|
+
async loadCheckpoint(sessionKey) {
|
|
564
|
+
try {
|
|
565
|
+
const raw = await readFile(this.checkpointPath, "utf-8");
|
|
566
|
+
const checkpoint = JSON.parse(raw);
|
|
567
|
+
if (!checkpoint.sessionKey || !checkpoint.capturedAt || !checkpoint.ttl || !Array.isArray(checkpoint.turns)) {
|
|
568
|
+
log.warn("checkpoint file has invalid structure");
|
|
569
|
+
return null;
|
|
570
|
+
}
|
|
571
|
+
if (sessionKey && checkpoint.sessionKey !== sessionKey) {
|
|
572
|
+
log.debug(`checkpoint session mismatch: ${checkpoint.sessionKey} vs ${sessionKey}`);
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
const ttl = new Date(checkpoint.ttl);
|
|
576
|
+
if (isNaN(ttl.getTime())) {
|
|
577
|
+
log.warn("checkpoint has invalid TTL format");
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
if (ttl < /* @__PURE__ */ new Date()) {
|
|
581
|
+
log.info(`checkpoint expired at ${checkpoint.ttl}`);
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
log.info(`loaded checkpoint with ${checkpoint.turns.length} turn(s), expires at ${checkpoint.ttl}`);
|
|
585
|
+
return checkpoint;
|
|
586
|
+
} catch (err) {
|
|
587
|
+
log.debug("no valid checkpoint found");
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Clear (delete) the checkpoint file.
|
|
593
|
+
* Called after successful injection of checkpoint context.
|
|
594
|
+
*/
|
|
595
|
+
async clearCheckpoint() {
|
|
596
|
+
try {
|
|
597
|
+
await unlink(this.checkpointPath);
|
|
598
|
+
log.info("cleared checkpoint");
|
|
599
|
+
} catch (err) {
|
|
600
|
+
log.debug("no checkpoint to clear");
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Format entries for recall injection.
|
|
605
|
+
* Returns a formatted string suitable for injecting into agent context.
|
|
606
|
+
*
|
|
607
|
+
* Format:
|
|
608
|
+
* ## Recent Conversation (last X hours)
|
|
609
|
+
* [10:32] User: message content
|
|
610
|
+
* [10:33] Assistant: response content
|
|
611
|
+
*
|
|
612
|
+
* Content is trimmed to approximately maxTokens.
|
|
613
|
+
*/
|
|
614
|
+
formatForRecall(entries, maxTokens) {
|
|
615
|
+
if (entries.length === 0) {
|
|
616
|
+
return "";
|
|
617
|
+
}
|
|
618
|
+
const maxChars = maxTokens * _TranscriptManager.CHARS_PER_TOKEN;
|
|
619
|
+
const lines = [];
|
|
620
|
+
const firstEntry = new Date(entries[0].timestamp);
|
|
621
|
+
const lastEntry = new Date(entries[entries.length - 1].timestamp);
|
|
622
|
+
const hoursDiff = Math.round((lastEntry.getTime() - firstEntry.getTime()) / (60 * 60 * 1e3));
|
|
623
|
+
if (hoursDiff < 1) {
|
|
624
|
+
lines.push("## Recent Conversation (last few minutes)");
|
|
625
|
+
} else {
|
|
626
|
+
lines.push(`## Recent Conversation (last ${hoursDiff} hour${hoursDiff === 1 ? "" : "s"})`);
|
|
627
|
+
}
|
|
628
|
+
lines.push("");
|
|
629
|
+
const formattedEntries = [];
|
|
630
|
+
for (const entry of entries) {
|
|
631
|
+
const time = new Date(entry.timestamp);
|
|
632
|
+
const timeStr = time.toLocaleTimeString("en-US", {
|
|
633
|
+
hour: "2-digit",
|
|
634
|
+
minute: "2-digit",
|
|
635
|
+
hour12: false
|
|
636
|
+
});
|
|
637
|
+
const roleLabel = entry.role === "user" ? "User" : "Assistant";
|
|
638
|
+
formattedEntries.push(`[${timeStr}] ${roleLabel}: ${entry.content}`);
|
|
639
|
+
}
|
|
640
|
+
let totalChars = lines.join("\n").length;
|
|
641
|
+
const selectedEntries = [];
|
|
642
|
+
for (let i = formattedEntries.length - 1; i >= 0; i--) {
|
|
643
|
+
const entry = formattedEntries[i];
|
|
644
|
+
const entryChars = entry.length + 1;
|
|
645
|
+
if (totalChars + entryChars > maxChars && selectedEntries.length > 0) {
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
selectedEntries.unshift(entry);
|
|
649
|
+
totalChars += entryChars;
|
|
650
|
+
}
|
|
651
|
+
lines.push(...selectedEntries);
|
|
652
|
+
lines.push("");
|
|
653
|
+
const result = lines.join("\n");
|
|
654
|
+
log.debug(`formatted ${selectedEntries.length}/${entries.length} transcript entries for recall (~${result.length} chars)`);
|
|
655
|
+
return result;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Create a checkpoint from the current buffer state.
|
|
659
|
+
* Helper method for creating checkpoints before compaction.
|
|
660
|
+
*/
|
|
661
|
+
createCheckpoint(sessionKey, turns, ttlHours) {
|
|
662
|
+
const ttl = ttlHours ?? _TranscriptManager.DEFAULT_CHECKPOINT_TTL_HOURS;
|
|
663
|
+
const expiresAt = /* @__PURE__ */ new Date();
|
|
664
|
+
expiresAt.setHours(expiresAt.getHours() + ttl);
|
|
665
|
+
return {
|
|
666
|
+
sessionKey,
|
|
667
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
668
|
+
turns: [...turns],
|
|
669
|
+
// Copy turns to avoid mutation
|
|
670
|
+
ttl: expiresAt.toISOString()
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Get statistics about stored transcripts.
|
|
675
|
+
* Returns counts from the hierarchical directory structure.
|
|
676
|
+
*/
|
|
677
|
+
async getStats() {
|
|
678
|
+
try {
|
|
679
|
+
const allFiles = await this.getAllTranscriptFiles();
|
|
680
|
+
if (allFiles.length === 0) {
|
|
681
|
+
return {
|
|
682
|
+
totalFiles: 0,
|
|
683
|
+
totalEntries: 0,
|
|
684
|
+
oldestFile: null,
|
|
685
|
+
newestFile: null,
|
|
686
|
+
channelTypes: {}
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
const sortedFiles = allFiles.sort();
|
|
690
|
+
let totalEntries = 0;
|
|
691
|
+
const channelTypes = {};
|
|
692
|
+
for (const relativePath of allFiles) {
|
|
693
|
+
const filePath = path.join(this.transcriptsDir, relativePath);
|
|
694
|
+
try {
|
|
695
|
+
const content = await readFile(filePath, "utf-8");
|
|
696
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
697
|
+
totalEntries += lines.length;
|
|
698
|
+
const channelType = relativePath.includes(path.sep) ? relativePath.split(path.sep)[0] : "legacy";
|
|
699
|
+
channelTypes[channelType] = (channelTypes[channelType] || 0) + 1;
|
|
700
|
+
} catch {
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return {
|
|
704
|
+
totalFiles: allFiles.length,
|
|
705
|
+
totalEntries,
|
|
706
|
+
oldestFile: sortedFiles[0],
|
|
707
|
+
newestFile: sortedFiles[sortedFiles.length - 1],
|
|
708
|
+
channelTypes
|
|
709
|
+
};
|
|
710
|
+
} catch (err) {
|
|
711
|
+
log.error("failed to get transcript stats:", err);
|
|
712
|
+
return {
|
|
713
|
+
totalFiles: 0,
|
|
714
|
+
totalEntries: 0,
|
|
715
|
+
oldestFile: null,
|
|
716
|
+
newestFile: null,
|
|
717
|
+
channelTypes: {}
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
async analyzeIntegrity() {
|
|
722
|
+
return analyzeSessionIntegrity({ memoryDir: this.config.memoryDir });
|
|
723
|
+
}
|
|
724
|
+
async getRecoverySummary(sessionKey) {
|
|
725
|
+
const report = await this.analyzeIntegrity();
|
|
726
|
+
const selectedSessions = sessionKey ? report.sessions.filter((session) => session.sessionKey === sessionKey) : report.sessions;
|
|
727
|
+
const incompleteTurns = selectedSessions.reduce((sum, session) => sum + session.incompleteTurns, 0);
|
|
728
|
+
const brokenChains = selectedSessions.reduce((sum, session) => sum + session.brokenChains, 0);
|
|
729
|
+
const filteredIssues = report.issues.filter((issue) => !sessionKey || issue.sessionKey === sessionKey);
|
|
730
|
+
const issueCount = filteredIssues.length;
|
|
731
|
+
const severeIssueCount = filteredIssues.filter((issue) => issue.severity !== "info").length;
|
|
732
|
+
return {
|
|
733
|
+
generatedAt: report.generatedAt,
|
|
734
|
+
sessionKey,
|
|
735
|
+
healthy: sessionKey ? severeIssueCount === 0 && report.checkpoint.healthy : report.healthy,
|
|
736
|
+
issueCount,
|
|
737
|
+
incompleteTurns,
|
|
738
|
+
brokenChains,
|
|
739
|
+
checkpointHealthy: report.checkpoint.healthy
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
export {
|
|
745
|
+
TranscriptManager
|
|
746
|
+
};
|
|
747
|
+
//# sourceMappingURL=chunk-UV2FO7J4.js.map
|