@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,720 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StorageManager
|
|
3
|
+
} from "./chunk-QWUUMMIK.js";
|
|
4
|
+
import {
|
|
5
|
+
decideLifecycleTransition
|
|
6
|
+
} from "./chunk-QCCCQT3O.js";
|
|
7
|
+
|
|
8
|
+
// src/maintenance/memory-governance.ts
|
|
9
|
+
import path from "path";
|
|
10
|
+
import { mkdir, readFile, readdir, rm, writeFile } from "fs/promises";
|
|
11
|
+
var RULE_VERSION = "memory-governance.v2";
|
|
12
|
+
var SEMANTIC_DUPLICATE_MIN_TOKENS = 6;
|
|
13
|
+
var SEMANTIC_DUPLICATE_MIN_JACCARD = 0.66;
|
|
14
|
+
var QUALITY_SCORE_WEIGHTS = {
|
|
15
|
+
exact_duplicate: 6,
|
|
16
|
+
semantic_duplicate_candidate: 4,
|
|
17
|
+
disputed_memory: 15,
|
|
18
|
+
speculative_low_confidence: 8,
|
|
19
|
+
archive_candidate: 2,
|
|
20
|
+
explicit_capture_review: 5,
|
|
21
|
+
malformed_import: 12
|
|
22
|
+
};
|
|
23
|
+
function governanceRunsDir(memoryDir) {
|
|
24
|
+
return path.join(memoryDir, "state", "memory-governance", "runs");
|
|
25
|
+
}
|
|
26
|
+
function governanceRunDir(memoryDir, runId) {
|
|
27
|
+
return path.join(governanceRunsDir(memoryDir), runId);
|
|
28
|
+
}
|
|
29
|
+
function governanceRestorePath(memoryDir, runId) {
|
|
30
|
+
return path.join(governanceRunDir(memoryDir, runId), "restore.json");
|
|
31
|
+
}
|
|
32
|
+
function buildRunId(now) {
|
|
33
|
+
return `gov-${now.toISOString().replace(/[:.]/g, "-")}`;
|
|
34
|
+
}
|
|
35
|
+
function plannedArchivePath(memoryDir, originalPath, now) {
|
|
36
|
+
return path.join(
|
|
37
|
+
memoryDir,
|
|
38
|
+
"archive",
|
|
39
|
+
now.toISOString().slice(0, 10),
|
|
40
|
+
path.basename(originalPath)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function normalizeContent(content) {
|
|
44
|
+
return content.trim().replace(/\s+/g, " ").toLowerCase();
|
|
45
|
+
}
|
|
46
|
+
function statusOf(memory) {
|
|
47
|
+
return memory.frontmatter.status ?? "active";
|
|
48
|
+
}
|
|
49
|
+
function parseIsoMs(value) {
|
|
50
|
+
if (!value) return null;
|
|
51
|
+
const ms = Date.parse(value);
|
|
52
|
+
return Number.isFinite(ms) ? ms : null;
|
|
53
|
+
}
|
|
54
|
+
function daysSince(value, now) {
|
|
55
|
+
const ts = parseIsoMs(value);
|
|
56
|
+
if (ts === null) return 365;
|
|
57
|
+
return Math.max(0, (now.getTime() - ts) / 864e5);
|
|
58
|
+
}
|
|
59
|
+
function compareCanonicalPreference(left, right) {
|
|
60
|
+
if (left.frontmatter.confidence !== right.frontmatter.confidence) {
|
|
61
|
+
return (right.frontmatter.confidence ?? 0) - (left.frontmatter.confidence ?? 0);
|
|
62
|
+
}
|
|
63
|
+
return left.frontmatter.created.localeCompare(right.frontmatter.created);
|
|
64
|
+
}
|
|
65
|
+
function proposedStatusPriority(status) {
|
|
66
|
+
switch (status) {
|
|
67
|
+
case "quarantined":
|
|
68
|
+
return 4;
|
|
69
|
+
case "rejected":
|
|
70
|
+
return 3;
|
|
71
|
+
case "archived":
|
|
72
|
+
return 2;
|
|
73
|
+
case "pending_review":
|
|
74
|
+
return 1;
|
|
75
|
+
default:
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function proposedActionPriority(action) {
|
|
80
|
+
if (action.action === "archive") {
|
|
81
|
+
return proposedStatusPriority("archived");
|
|
82
|
+
}
|
|
83
|
+
return proposedStatusPriority(action.afterStatus ?? "active");
|
|
84
|
+
}
|
|
85
|
+
function tokenizeSemanticContent(content) {
|
|
86
|
+
return Array.from(
|
|
87
|
+
new Set(
|
|
88
|
+
normalizeContent(content).replaceAll(/[^\p{L}\p{N}]+/gu, " ").split(" ").filter((token) => token.length >= 4)
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function jaccardSimilarity(left, right) {
|
|
93
|
+
if (left.length === 0 || right.length === 0) return 0;
|
|
94
|
+
const leftSet = new Set(left);
|
|
95
|
+
const rightSet = new Set(right);
|
|
96
|
+
let intersection = 0;
|
|
97
|
+
for (const token of leftSet) {
|
|
98
|
+
if (rightSet.has(token)) intersection += 1;
|
|
99
|
+
}
|
|
100
|
+
const union = (/* @__PURE__ */ new Set([...leftSet, ...rightSet])).size;
|
|
101
|
+
return union > 0 ? intersection / union : 0;
|
|
102
|
+
}
|
|
103
|
+
function sameSemanticDuplicateScope(left, right) {
|
|
104
|
+
if (left.frontmatter.category !== right.frontmatter.category) return false;
|
|
105
|
+
const leftEntityRef = left.frontmatter.entityRef?.trim();
|
|
106
|
+
const rightEntityRef = right.frontmatter.entityRef?.trim();
|
|
107
|
+
if (leftEntityRef && rightEntityRef && leftEntityRef !== rightEntityRef) return false;
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
function buildSemanticDuplicateEntries(activeMemories) {
|
|
111
|
+
const reviewQueue = [];
|
|
112
|
+
const ordered = [...activeMemories].sort(compareCanonicalPreference);
|
|
113
|
+
const tokensByMemoryId = new Map(
|
|
114
|
+
ordered.map((memory) => [memory.frontmatter.id, tokenizeSemanticContent(memory.content)])
|
|
115
|
+
);
|
|
116
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
117
|
+
for (let candidateIndex = 1; candidateIndex < ordered.length; candidateIndex += 1) {
|
|
118
|
+
const candidate = ordered[candidateIndex];
|
|
119
|
+
if (claimed.has(candidate.frontmatter.id)) continue;
|
|
120
|
+
const candidateTokens = tokensByMemoryId.get(candidate.frontmatter.id) ?? [];
|
|
121
|
+
if (candidateTokens.length < SEMANTIC_DUPLICATE_MIN_TOKENS) continue;
|
|
122
|
+
const candidateNormalized = normalizeContent(candidate.content);
|
|
123
|
+
for (let canonicalIndex = 0; canonicalIndex < candidateIndex; canonicalIndex += 1) {
|
|
124
|
+
const canonical = ordered[canonicalIndex];
|
|
125
|
+
if (!sameSemanticDuplicateScope(canonical, candidate)) continue;
|
|
126
|
+
const canonicalNormalized = normalizeContent(canonical.content);
|
|
127
|
+
if (canonicalNormalized === candidateNormalized) continue;
|
|
128
|
+
const canonicalTokens = tokensByMemoryId.get(canonical.frontmatter.id) ?? [];
|
|
129
|
+
if (canonicalTokens.length < SEMANTIC_DUPLICATE_MIN_TOKENS) continue;
|
|
130
|
+
const shorter = Math.min(candidateTokens.length, canonicalTokens.length);
|
|
131
|
+
const longer = Math.max(candidateTokens.length, canonicalTokens.length);
|
|
132
|
+
if (shorter / longer < 0.6) continue;
|
|
133
|
+
if (jaccardSimilarity(candidateTokens, canonicalTokens) < SEMANTIC_DUPLICATE_MIN_JACCARD) continue;
|
|
134
|
+
reviewQueue.push({
|
|
135
|
+
entryId: `review:${candidate.frontmatter.id}:semantic_duplicate_candidate`,
|
|
136
|
+
memoryId: candidate.frontmatter.id,
|
|
137
|
+
path: candidate.path,
|
|
138
|
+
reasonCode: "semantic_duplicate_candidate",
|
|
139
|
+
severity: "medium",
|
|
140
|
+
suggestedAction: "set_status",
|
|
141
|
+
suggestedStatus: "pending_review",
|
|
142
|
+
relatedMemoryIds: [canonical.frontmatter.id]
|
|
143
|
+
});
|
|
144
|
+
claimed.add(candidate.frontmatter.id);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return reviewQueue;
|
|
149
|
+
}
|
|
150
|
+
function buildExplicitCaptureReviewEntries(memories, lifecycleEvents) {
|
|
151
|
+
const explicitQueuedIds = new Set(
|
|
152
|
+
lifecycleEvents.filter((event) => event.eventType === "explicit_capture_queued").map((event) => event.memoryId)
|
|
153
|
+
);
|
|
154
|
+
return memories.filter((memory) => {
|
|
155
|
+
if (statusOf(memory) !== "pending_review") return false;
|
|
156
|
+
const tags = memory.frontmatter.tags ?? [];
|
|
157
|
+
if (tags.includes("queued-review")) return true;
|
|
158
|
+
if (explicitQueuedIds.has(memory.frontmatter.id)) return true;
|
|
159
|
+
return memory.frontmatter.source === "explicit-review" || memory.frontmatter.source === "explicit-inline-review";
|
|
160
|
+
}).map((memory) => ({
|
|
161
|
+
entryId: `review:${memory.frontmatter.id}:explicit_capture_review`,
|
|
162
|
+
memoryId: memory.frontmatter.id,
|
|
163
|
+
path: memory.path,
|
|
164
|
+
reasonCode: "explicit_capture_review",
|
|
165
|
+
severity: "medium",
|
|
166
|
+
suggestedAction: "set_status",
|
|
167
|
+
suggestedStatus: "pending_review",
|
|
168
|
+
relatedMemoryIds: []
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
async function listMarkdownFiles(root) {
|
|
172
|
+
const files = [];
|
|
173
|
+
const walk = async (dir) => {
|
|
174
|
+
try {
|
|
175
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
176
|
+
for (const entry of entries) {
|
|
177
|
+
const fullPath = path.join(dir, entry.name);
|
|
178
|
+
if (entry.isDirectory()) {
|
|
179
|
+
await walk(fullPath);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
183
|
+
files.push(fullPath);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} catch {
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
await walk(root);
|
|
190
|
+
return files;
|
|
191
|
+
}
|
|
192
|
+
function malformedMemoryId(memoryDir, filePath) {
|
|
193
|
+
return `malformed:${path.relative(memoryDir, filePath).replaceAll(path.sep, "/")}`;
|
|
194
|
+
}
|
|
195
|
+
async function buildMalformedImportEntries(memoryDir, storage, parsedMemories, candidateFiles) {
|
|
196
|
+
const parsedPaths = new Set(parsedMemories.map((memory) => memory.path));
|
|
197
|
+
const filesToInspect = candidateFiles ?? [
|
|
198
|
+
...await listMarkdownFiles(path.join(memoryDir, "facts")),
|
|
199
|
+
...await listMarkdownFiles(path.join(memoryDir, "corrections"))
|
|
200
|
+
];
|
|
201
|
+
const entries = [];
|
|
202
|
+
for (const filePath of filesToInspect) {
|
|
203
|
+
if (parsedPaths.has(filePath)) continue;
|
|
204
|
+
const parsed = await storage.readMemoryByPath(filePath);
|
|
205
|
+
if (parsed) continue;
|
|
206
|
+
entries.push({
|
|
207
|
+
entryId: `review:${malformedMemoryId(memoryDir, filePath)}:malformed_import`,
|
|
208
|
+
memoryId: malformedMemoryId(memoryDir, filePath),
|
|
209
|
+
path: filePath,
|
|
210
|
+
reasonCode: "malformed_import",
|
|
211
|
+
severity: "high",
|
|
212
|
+
suggestedAction: "set_status",
|
|
213
|
+
suggestedStatus: "quarantined",
|
|
214
|
+
relatedMemoryIds: []
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return entries;
|
|
218
|
+
}
|
|
219
|
+
async function buildReviewQueue(memoryDir, storage, memories, now, options = {}) {
|
|
220
|
+
const reviewQueue = [];
|
|
221
|
+
const activeMemories = memories.filter((memory) => statusOf(memory) === "active");
|
|
222
|
+
const duplicateBuckets = /* @__PURE__ */ new Map();
|
|
223
|
+
for (const memory of activeMemories) {
|
|
224
|
+
const key = `${memory.frontmatter.category}:${normalizeContent(memory.content)}`;
|
|
225
|
+
const bucket = duplicateBuckets.get(key) ?? [];
|
|
226
|
+
bucket.push(memory);
|
|
227
|
+
duplicateBuckets.set(key, bucket);
|
|
228
|
+
}
|
|
229
|
+
for (const bucket of duplicateBuckets.values()) {
|
|
230
|
+
if (bucket.length < 2) continue;
|
|
231
|
+
const ordered = [...bucket].sort(compareCanonicalPreference);
|
|
232
|
+
const canonical = ordered[0];
|
|
233
|
+
for (const duplicate of ordered.slice(1)) {
|
|
234
|
+
reviewQueue.push({
|
|
235
|
+
entryId: `review:${duplicate.frontmatter.id}:exact_duplicate`,
|
|
236
|
+
memoryId: duplicate.frontmatter.id,
|
|
237
|
+
path: duplicate.path,
|
|
238
|
+
reasonCode: "exact_duplicate",
|
|
239
|
+
severity: "medium",
|
|
240
|
+
suggestedAction: "set_status",
|
|
241
|
+
suggestedStatus: "pending_review",
|
|
242
|
+
relatedMemoryIds: canonical ? [canonical.frontmatter.id] : []
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
reviewQueue.push(...buildSemanticDuplicateEntries(activeMemories));
|
|
247
|
+
for (const memory of activeMemories) {
|
|
248
|
+
if (memory.frontmatter.verificationState === "disputed") {
|
|
249
|
+
reviewQueue.push({
|
|
250
|
+
entryId: `review:${memory.frontmatter.id}:disputed_memory`,
|
|
251
|
+
memoryId: memory.frontmatter.id,
|
|
252
|
+
path: memory.path,
|
|
253
|
+
reasonCode: "disputed_memory",
|
|
254
|
+
severity: "high",
|
|
255
|
+
suggestedAction: "set_status",
|
|
256
|
+
suggestedStatus: "quarantined",
|
|
257
|
+
relatedMemoryIds: []
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
if (memory.frontmatter.confidenceTier === "speculative" && (memory.frontmatter.confidence ?? 0) <= 0.25) {
|
|
261
|
+
reviewQueue.push({
|
|
262
|
+
entryId: `review:${memory.frontmatter.id}:speculative_low_confidence`,
|
|
263
|
+
memoryId: memory.frontmatter.id,
|
|
264
|
+
path: memory.path,
|
|
265
|
+
reasonCode: "speculative_low_confidence",
|
|
266
|
+
severity: "medium",
|
|
267
|
+
suggestedAction: "set_status",
|
|
268
|
+
suggestedStatus: "pending_review",
|
|
269
|
+
relatedMemoryIds: []
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
const lifecycle = decideLifecycleTransition(memory, {}, now);
|
|
273
|
+
const staleForArchive = memory.frontmatter.lifecycleState === "stale" && daysSince(memory.frontmatter.updated ?? memory.frontmatter.created, now) >= 180;
|
|
274
|
+
if (lifecycle.nextState === "archived" && lifecycle.changed || staleForArchive) {
|
|
275
|
+
reviewQueue.push({
|
|
276
|
+
entryId: `review:${memory.frontmatter.id}:archive_candidate`,
|
|
277
|
+
memoryId: memory.frontmatter.id,
|
|
278
|
+
path: memory.path,
|
|
279
|
+
reasonCode: "archive_candidate",
|
|
280
|
+
severity: "low",
|
|
281
|
+
suggestedAction: "archive",
|
|
282
|
+
relatedMemoryIds: []
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const lifecycleEvents = await storage.readMemoryLifecycleEvents(Number.MAX_SAFE_INTEGER);
|
|
287
|
+
reviewQueue.push(...buildExplicitCaptureReviewEntries(memories, lifecycleEvents));
|
|
288
|
+
reviewQueue.push(...await buildMalformedImportEntries(
|
|
289
|
+
memoryDir,
|
|
290
|
+
storage,
|
|
291
|
+
memories,
|
|
292
|
+
options.malformedCandidateFiles
|
|
293
|
+
));
|
|
294
|
+
return reviewQueue;
|
|
295
|
+
}
|
|
296
|
+
function buildProposedActions(reviewQueue, memories) {
|
|
297
|
+
const byMemory = new Map(memories.map((memory) => [memory.frontmatter.id, memory]));
|
|
298
|
+
const selected = /* @__PURE__ */ new Map();
|
|
299
|
+
for (const entry of reviewQueue) {
|
|
300
|
+
const memory = byMemory.get(entry.memoryId);
|
|
301
|
+
if (!memory) continue;
|
|
302
|
+
const currentStatus = statusOf(memory);
|
|
303
|
+
if (entry.suggestedAction === "set_status" && entry.suggestedStatus && entry.suggestedStatus === currentStatus) {
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
const candidate = {
|
|
307
|
+
action: entry.suggestedAction,
|
|
308
|
+
memoryId: entry.memoryId,
|
|
309
|
+
reasonCode: entry.reasonCode,
|
|
310
|
+
beforeStatus: currentStatus,
|
|
311
|
+
afterStatus: entry.suggestedStatus,
|
|
312
|
+
originalPath: memory.path,
|
|
313
|
+
currentPath: memory.path
|
|
314
|
+
};
|
|
315
|
+
const existing = selected.get(entry.memoryId);
|
|
316
|
+
if (!existing) {
|
|
317
|
+
selected.set(entry.memoryId, candidate);
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
const existingPriority = proposedActionPriority(existing);
|
|
321
|
+
const candidatePriority = proposedActionPriority(candidate);
|
|
322
|
+
if (candidatePriority > existingPriority) {
|
|
323
|
+
selected.set(entry.memoryId, candidate);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return [...selected.values()];
|
|
327
|
+
}
|
|
328
|
+
function buildMetrics(reviewQueue, proposedActions, scannedMemories) {
|
|
329
|
+
const reviewReasons = {
|
|
330
|
+
exact_duplicate: 0,
|
|
331
|
+
semantic_duplicate_candidate: 0,
|
|
332
|
+
disputed_memory: 0,
|
|
333
|
+
speculative_low_confidence: 0,
|
|
334
|
+
archive_candidate: 0,
|
|
335
|
+
explicit_capture_review: 0,
|
|
336
|
+
malformed_import: 0
|
|
337
|
+
};
|
|
338
|
+
const proposedStatuses = {};
|
|
339
|
+
for (const entry of reviewQueue) {
|
|
340
|
+
reviewReasons[entry.reasonCode] += 1;
|
|
341
|
+
}
|
|
342
|
+
for (const action of proposedActions) {
|
|
343
|
+
const effectiveStatus = action.afterStatus ?? (action.action === "archive" ? "archived" : void 0);
|
|
344
|
+
if (!effectiveStatus) continue;
|
|
345
|
+
proposedStatuses[effectiveStatus] = (proposedStatuses[effectiveStatus] ?? 0) + 1;
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
reviewReasons,
|
|
349
|
+
proposedStatuses,
|
|
350
|
+
keptMemoryCount: Math.max(0, scannedMemories - proposedActions.length),
|
|
351
|
+
qualityScore: buildQualityScore(reviewReasons)
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function buildQualityScore(reviewReasons) {
|
|
355
|
+
const deductions = Object.entries(reviewReasons).map(([reasonCode, count]) => ({
|
|
356
|
+
reasonCode,
|
|
357
|
+
count,
|
|
358
|
+
pointsLost: count * QUALITY_SCORE_WEIGHTS[reasonCode]
|
|
359
|
+
})).filter((entry) => entry.count > 0).sort((left, right) => right.pointsLost - left.pointsLost);
|
|
360
|
+
const totalPointsLost = deductions.reduce((sum, entry) => sum + entry.pointsLost, 0);
|
|
361
|
+
const score = Math.max(0, 100 - totalPointsLost);
|
|
362
|
+
const grade = score >= 90 ? "excellent" : score >= 75 ? "good" : score >= 50 ? "fair" : "poor";
|
|
363
|
+
return {
|
|
364
|
+
score,
|
|
365
|
+
maxScore: 100,
|
|
366
|
+
grade,
|
|
367
|
+
deductions
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function groupActionsByStatus(actions) {
|
|
371
|
+
const grouped = {};
|
|
372
|
+
for (const action of actions) {
|
|
373
|
+
const status = action.afterStatus ?? (action.action === "archive" ? "archived" : "unchanged");
|
|
374
|
+
const bucket = grouped[status] ?? [];
|
|
375
|
+
bucket.push(action);
|
|
376
|
+
grouped[status] = bucket;
|
|
377
|
+
}
|
|
378
|
+
return grouped;
|
|
379
|
+
}
|
|
380
|
+
async function safeRead(filePath) {
|
|
381
|
+
try {
|
|
382
|
+
return await readFile(filePath, "utf-8");
|
|
383
|
+
} catch {
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
async function persistRestoreManifest(memoryDir, manifest) {
|
|
388
|
+
const restorePath = governanceRestorePath(memoryDir, manifest.runId);
|
|
389
|
+
await mkdir(path.dirname(restorePath), { recursive: true });
|
|
390
|
+
await writeFile(restorePath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
391
|
+
return restorePath;
|
|
392
|
+
}
|
|
393
|
+
async function writeGovernanceArtifacts(options) {
|
|
394
|
+
const runDir = governanceRunDir(options.memoryDir, options.runId);
|
|
395
|
+
await mkdir(runDir, { recursive: true });
|
|
396
|
+
const summaryPath = path.join(runDir, "summary.json");
|
|
397
|
+
const reviewQueuePath = path.join(runDir, "review-queue.json");
|
|
398
|
+
const qualityScorePath = path.join(runDir, "quality-score.json");
|
|
399
|
+
const transitionReportPath = path.join(runDir, "status-transitions.json");
|
|
400
|
+
const reportPath = path.join(runDir, "report.md");
|
|
401
|
+
const keptMemoriesPath = path.join(runDir, "kept-memories.json");
|
|
402
|
+
const appliedActionsPath = path.join(runDir, "applied-actions.json");
|
|
403
|
+
const metricsPath = path.join(runDir, "metrics.json");
|
|
404
|
+
const manifestPath = path.join(runDir, "manifest.json");
|
|
405
|
+
const restorePath = options.restoreManifest ? governanceRestorePath(options.memoryDir, options.runId) : void 0;
|
|
406
|
+
await writeFile(summaryPath, JSON.stringify(options.summary, null, 2), "utf-8");
|
|
407
|
+
await writeFile(reviewQueuePath, JSON.stringify(options.reviewQueue, null, 2), "utf-8");
|
|
408
|
+
await writeFile(qualityScorePath, JSON.stringify(options.qualityScore, null, 2), "utf-8");
|
|
409
|
+
await writeFile(transitionReportPath, JSON.stringify(options.transitionReport, null, 2), "utf-8");
|
|
410
|
+
await writeFile(keptMemoriesPath, JSON.stringify(options.keptMemoryIds, null, 2), "utf-8");
|
|
411
|
+
await writeFile(appliedActionsPath, JSON.stringify(options.appliedActions, null, 2), "utf-8");
|
|
412
|
+
await writeFile(metricsPath, JSON.stringify(options.metrics, null, 2), "utf-8");
|
|
413
|
+
await writeFile(
|
|
414
|
+
reportPath,
|
|
415
|
+
[
|
|
416
|
+
`# Memory Governance Run ${options.runId}`,
|
|
417
|
+
"",
|
|
418
|
+
`- Trace ID: ${options.traceId}`,
|
|
419
|
+
`- Mode: ${options.summary.mode}`,
|
|
420
|
+
`- Scanned memories: ${options.summary.scannedMemories}`,
|
|
421
|
+
`- Kept memories: ${options.metrics.keptMemoryCount}`,
|
|
422
|
+
`- Review queue entries: ${options.summary.reviewQueueCount}`,
|
|
423
|
+
`- Proposed actions: ${options.summary.proposedActionCount}`,
|
|
424
|
+
`- Applied actions: ${options.summary.appliedActionCount}`,
|
|
425
|
+
`- Quality score: ${options.qualityScore.score}/${options.qualityScore.maxScore} (${options.qualityScore.grade})`,
|
|
426
|
+
"",
|
|
427
|
+
"## Metrics",
|
|
428
|
+
...Object.entries(options.metrics.reviewReasons).map(([reason, count]) => `- ${reason}: ${count}`),
|
|
429
|
+
...Object.entries(options.metrics.proposedStatuses).length > 0 ? Object.entries(options.metrics.proposedStatuses).map(([status, count]) => `- proposed ${status}: ${count}`) : ["- proposed statuses: (none)"],
|
|
430
|
+
"",
|
|
431
|
+
"## Quality Score",
|
|
432
|
+
...options.qualityScore.deductions.length > 0 ? options.qualityScore.deductions.map((entry) => `- ${entry.reasonCode}: ${entry.count} -> -${entry.pointsLost}`) : ["- no deductions"],
|
|
433
|
+
"",
|
|
434
|
+
"## Proposed Actions",
|
|
435
|
+
...options.proposedActions.length > 0 ? options.proposedActions.map(
|
|
436
|
+
(action) => `- ${action.memoryId}: ${action.action}${action.afterStatus ? ` -> ${action.afterStatus}` : ""} [${action.reasonCode}]`
|
|
437
|
+
) : ["- (empty)"],
|
|
438
|
+
"",
|
|
439
|
+
"## Applied Actions",
|
|
440
|
+
...options.appliedActions.length > 0 ? options.appliedActions.map(
|
|
441
|
+
(action) => `- ${action.memoryId}: ${action.action}${action.afterStatus ? ` -> ${action.afterStatus}` : ""} [${action.reasonCode}]`
|
|
442
|
+
) : ["- (empty)"],
|
|
443
|
+
"",
|
|
444
|
+
"## Review Queue",
|
|
445
|
+
...options.reviewQueue.length > 0 ? options.reviewQueue.map(
|
|
446
|
+
(entry) => `- ${entry.memoryId}: ${entry.reasonCode} -> ${entry.suggestedAction}${entry.suggestedStatus ? ` (${entry.suggestedStatus})` : ""}`
|
|
447
|
+
) : ["- (empty)"]
|
|
448
|
+
].join("\n"),
|
|
449
|
+
"utf-8"
|
|
450
|
+
);
|
|
451
|
+
const manifest = {
|
|
452
|
+
schemaVersion: 1,
|
|
453
|
+
runId: options.runId,
|
|
454
|
+
traceId: options.traceId,
|
|
455
|
+
mode: options.summary.mode,
|
|
456
|
+
createdAt: options.summary.createdAt,
|
|
457
|
+
ruleVersion: options.summary.ruleVersion,
|
|
458
|
+
artifacts: {
|
|
459
|
+
summary: summaryPath,
|
|
460
|
+
reviewQueue: reviewQueuePath,
|
|
461
|
+
qualityScore: qualityScorePath,
|
|
462
|
+
transitionReport: transitionReportPath,
|
|
463
|
+
report: reportPath,
|
|
464
|
+
keptMemories: keptMemoriesPath,
|
|
465
|
+
appliedActions: appliedActionsPath,
|
|
466
|
+
metrics: metricsPath,
|
|
467
|
+
...restorePath ? { restore: restorePath } : {}
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
await writeFile(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
471
|
+
if (restorePath && options.restoreManifest && await safeRead(restorePath) === null) {
|
|
472
|
+
await writeFile(restorePath, JSON.stringify(options.restoreManifest, null, 2), "utf-8");
|
|
473
|
+
}
|
|
474
|
+
return {
|
|
475
|
+
summaryPath,
|
|
476
|
+
reviewQueuePath,
|
|
477
|
+
qualityScorePath,
|
|
478
|
+
transitionReportPath,
|
|
479
|
+
reportPath,
|
|
480
|
+
keptMemoriesPath,
|
|
481
|
+
appliedActionsPath,
|
|
482
|
+
metricsPath,
|
|
483
|
+
manifestPath,
|
|
484
|
+
restorePath
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
async function runMemoryGovernance(options) {
|
|
488
|
+
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
489
|
+
const runId = buildRunId(now);
|
|
490
|
+
const traceId = runId;
|
|
491
|
+
const storage = new StorageManager(options.memoryDir);
|
|
492
|
+
const boundedScan = options.maxMemories !== void 0 || options.recentDays !== void 0 || options.batchSize !== void 0;
|
|
493
|
+
const normalizedRecentDays = typeof options.recentDays === "number" && Number.isFinite(options.recentDays) ? Math.max(1, Math.floor(options.recentDays)) : void 0;
|
|
494
|
+
const updatedAfter = normalizedRecentDays !== void 0 ? new Date(now.getTime() - normalizedRecentDays * 864e5) : void 0;
|
|
495
|
+
const memoryWindow = boundedScan ? await storage.readMemoriesWindow({
|
|
496
|
+
maxMemories: options.maxMemories,
|
|
497
|
+
batchSize: options.batchSize,
|
|
498
|
+
updatedAfter
|
|
499
|
+
}) : void 0;
|
|
500
|
+
const memories = memoryWindow?.memories ?? await storage.readAllMemories();
|
|
501
|
+
const reviewQueue = await buildReviewQueue(options.memoryDir, storage, memories, now, {
|
|
502
|
+
malformedCandidateFiles: memoryWindow?.filePaths
|
|
503
|
+
});
|
|
504
|
+
const proposedActions = buildProposedActions(reviewQueue, memories);
|
|
505
|
+
const reviewEntryByActionKey = new Map(
|
|
506
|
+
reviewQueue.map((entry) => [`${entry.memoryId}:${entry.reasonCode}`, entry])
|
|
507
|
+
);
|
|
508
|
+
const metrics = buildMetrics(reviewQueue, proposedActions, memories.length);
|
|
509
|
+
const transitionReport = {
|
|
510
|
+
proposed: groupActionsByStatus(proposedActions),
|
|
511
|
+
applied: {}
|
|
512
|
+
};
|
|
513
|
+
const memoryPathById = new Map(memories.map((memory) => [memory.frontmatter.id, memory.path]));
|
|
514
|
+
const targetedMemoryIds = new Set(proposedActions.map((action) => action.memoryId));
|
|
515
|
+
const keptMemoryIds = memories.map((memory) => memory.frontmatter.id).filter((memoryId) => !targetedMemoryIds.has(memoryId));
|
|
516
|
+
const appliedActions = [];
|
|
517
|
+
const restoreEntries = [];
|
|
518
|
+
const restoreEntryByMemoryId = /* @__PURE__ */ new Map();
|
|
519
|
+
if (options.mode === "apply") {
|
|
520
|
+
for (const action of proposedActions) {
|
|
521
|
+
const memoryPath = memoryPathById.get(action.memoryId) ?? null;
|
|
522
|
+
if (!memoryPath) continue;
|
|
523
|
+
const memory = await storage.readMemoryByPath(memoryPath);
|
|
524
|
+
if (!memory) continue;
|
|
525
|
+
if (memory.frontmatter.id !== action.memoryId) continue;
|
|
526
|
+
const beforeRaw = await safeRead(memory.path);
|
|
527
|
+
if (!beforeRaw) continue;
|
|
528
|
+
const entry = {
|
|
529
|
+
action: action.action,
|
|
530
|
+
memoryId: action.memoryId,
|
|
531
|
+
reasonCode: action.reasonCode,
|
|
532
|
+
originalPath: memory.path,
|
|
533
|
+
currentPath: action.action === "archive" ? plannedArchivePath(options.memoryDir, memory.path, now) : memory.path,
|
|
534
|
+
beforeRaw,
|
|
535
|
+
applied: false
|
|
536
|
+
};
|
|
537
|
+
restoreEntries.push(entry);
|
|
538
|
+
restoreEntryByMemoryId.set(action.memoryId, entry);
|
|
539
|
+
}
|
|
540
|
+
const restoreManifest2 = {
|
|
541
|
+
runId,
|
|
542
|
+
createdAt: now.toISOString(),
|
|
543
|
+
entries: restoreEntries
|
|
544
|
+
};
|
|
545
|
+
await persistRestoreManifest(options.memoryDir, restoreManifest2);
|
|
546
|
+
for (const action of proposedActions) {
|
|
547
|
+
const memoryPath = memoryPathById.get(action.memoryId) ?? null;
|
|
548
|
+
if (!memoryPath) continue;
|
|
549
|
+
const memory = await storage.readMemoryByPath(memoryPath);
|
|
550
|
+
if (!memory) continue;
|
|
551
|
+
if (memory.frontmatter.id !== action.memoryId) continue;
|
|
552
|
+
const restoreEntry = restoreEntryByMemoryId.get(action.memoryId);
|
|
553
|
+
if (!restoreEntry) continue;
|
|
554
|
+
if (action.action === "archive") {
|
|
555
|
+
const reviewEntry2 = reviewEntryByActionKey.get(`${action.memoryId}:${action.reasonCode}`);
|
|
556
|
+
const archivedPath = await storage.archiveMemory(memory, {
|
|
557
|
+
at: now,
|
|
558
|
+
actor: "memory-governance.apply",
|
|
559
|
+
reasonCode: action.reasonCode,
|
|
560
|
+
ruleVersion: RULE_VERSION,
|
|
561
|
+
relatedMemoryIds: reviewEntry2?.relatedMemoryIds ?? [],
|
|
562
|
+
correlationId: traceId
|
|
563
|
+
});
|
|
564
|
+
if (!archivedPath) continue;
|
|
565
|
+
restoreEntry.currentPath = archivedPath;
|
|
566
|
+
restoreEntry.expectedCurrentRaw = await safeRead(archivedPath) ?? void 0;
|
|
567
|
+
restoreEntry.applied = true;
|
|
568
|
+
await persistRestoreManifest(options.memoryDir, restoreManifest2);
|
|
569
|
+
appliedActions.push({
|
|
570
|
+
...action,
|
|
571
|
+
currentPath: archivedPath,
|
|
572
|
+
afterStatus: "archived"
|
|
573
|
+
});
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
if (!action.afterStatus || action.beforeStatus === action.afterStatus) continue;
|
|
577
|
+
const reviewEntry = reviewEntryByActionKey.get(`${action.memoryId}:${action.reasonCode}`);
|
|
578
|
+
const updated = await storage.writeMemoryFrontmatter(memory, {
|
|
579
|
+
status: action.afterStatus,
|
|
580
|
+
updated: now.toISOString()
|
|
581
|
+
}, {
|
|
582
|
+
actor: "memory-governance.apply",
|
|
583
|
+
reasonCode: action.reasonCode,
|
|
584
|
+
ruleVersion: RULE_VERSION,
|
|
585
|
+
relatedMemoryIds: reviewEntry?.relatedMemoryIds ?? [],
|
|
586
|
+
correlationId: traceId
|
|
587
|
+
});
|
|
588
|
+
if (!updated) continue;
|
|
589
|
+
restoreEntry.expectedCurrentRaw = await safeRead(memory.path) ?? void 0;
|
|
590
|
+
restoreEntry.applied = true;
|
|
591
|
+
await persistRestoreManifest(options.memoryDir, restoreManifest2);
|
|
592
|
+
appliedActions.push({
|
|
593
|
+
...action,
|
|
594
|
+
currentPath: memory.path
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
const summary = {
|
|
599
|
+
schemaVersion: 1,
|
|
600
|
+
runId,
|
|
601
|
+
traceId,
|
|
602
|
+
mode: options.mode,
|
|
603
|
+
createdAt: now.toISOString(),
|
|
604
|
+
scannedMemories: memories.length,
|
|
605
|
+
reviewQueueCount: reviewQueue.length,
|
|
606
|
+
proposedActionCount: proposedActions.length,
|
|
607
|
+
appliedActionCount: appliedActions.length,
|
|
608
|
+
ruleVersion: RULE_VERSION
|
|
609
|
+
};
|
|
610
|
+
const restoreManifest = options.mode === "apply" ? {
|
|
611
|
+
runId,
|
|
612
|
+
createdAt: now.toISOString(),
|
|
613
|
+
entries: restoreEntries
|
|
614
|
+
} : void 0;
|
|
615
|
+
transitionReport.applied = groupActionsByStatus(appliedActions);
|
|
616
|
+
const paths = await writeGovernanceArtifacts({
|
|
617
|
+
memoryDir: options.memoryDir,
|
|
618
|
+
runId,
|
|
619
|
+
traceId,
|
|
620
|
+
summary,
|
|
621
|
+
metrics,
|
|
622
|
+
qualityScore: metrics.qualityScore,
|
|
623
|
+
transitionReport,
|
|
624
|
+
keptMemoryIds,
|
|
625
|
+
reviewQueue,
|
|
626
|
+
proposedActions,
|
|
627
|
+
appliedActions,
|
|
628
|
+
restoreManifest
|
|
629
|
+
});
|
|
630
|
+
return {
|
|
631
|
+
runId,
|
|
632
|
+
traceId,
|
|
633
|
+
mode: options.mode,
|
|
634
|
+
...paths,
|
|
635
|
+
reviewQueue,
|
|
636
|
+
proposedActions,
|
|
637
|
+
appliedActions
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
async function restoreMemoryGovernanceRun(options) {
|
|
641
|
+
void options.now;
|
|
642
|
+
const restorePath = governanceRestorePath(options.memoryDir, options.runId);
|
|
643
|
+
const raw = JSON.parse(await readFile(restorePath, "utf-8"));
|
|
644
|
+
let restoredActions = 0;
|
|
645
|
+
for (const entry of [...raw.entries].reverse()) {
|
|
646
|
+
if (!entry.applied) {
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
const currentRaw = await safeRead(entry.currentPath);
|
|
650
|
+
if (entry.expectedCurrentRaw && currentRaw !== entry.expectedCurrentRaw) {
|
|
651
|
+
throw new Error(`restore conflict for ${entry.memoryId}: current contents diverged from governance run`);
|
|
652
|
+
}
|
|
653
|
+
if (entry.action === "archive") {
|
|
654
|
+
await rm(entry.currentPath, { force: true });
|
|
655
|
+
}
|
|
656
|
+
await mkdir(path.dirname(entry.originalPath), { recursive: true });
|
|
657
|
+
await writeFile(entry.originalPath, entry.beforeRaw, "utf-8");
|
|
658
|
+
restoredActions += 1;
|
|
659
|
+
}
|
|
660
|
+
return {
|
|
661
|
+
runId: raw.runId,
|
|
662
|
+
restoredActions,
|
|
663
|
+
restorePath
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
async function listMemoryGovernanceRuns(memoryDir) {
|
|
667
|
+
try {
|
|
668
|
+
return (await readdir(governanceRunsDir(memoryDir))).sort().reverse();
|
|
669
|
+
} catch {
|
|
670
|
+
return [];
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
async function readMemoryGovernanceRunArtifact(memoryDir, runId) {
|
|
674
|
+
const runDir = governanceRunDir(memoryDir, runId);
|
|
675
|
+
const summary = JSON.parse(await readFile(path.join(runDir, "summary.json"), "utf-8"));
|
|
676
|
+
const metrics = JSON.parse(await readFile(path.join(runDir, "metrics.json"), "utf-8"));
|
|
677
|
+
metrics.qualityScore ??= buildQualityScore(metrics.reviewReasons);
|
|
678
|
+
const keptMemoryIds = JSON.parse(await readFile(path.join(runDir, "kept-memories.json"), "utf-8"));
|
|
679
|
+
const reviewQueue = JSON.parse(
|
|
680
|
+
await readFile(path.join(runDir, "review-queue.json"), "utf-8")
|
|
681
|
+
);
|
|
682
|
+
const appliedActions = JSON.parse(
|
|
683
|
+
await readFile(path.join(runDir, "applied-actions.json"), "utf-8")
|
|
684
|
+
);
|
|
685
|
+
const qualityScoreRaw = await safeRead(path.join(runDir, "quality-score.json"));
|
|
686
|
+
const transitionReportRaw = await safeRead(path.join(runDir, "status-transitions.json"));
|
|
687
|
+
const manifest = JSON.parse(
|
|
688
|
+
await readFile(path.join(runDir, "manifest.json"), "utf-8")
|
|
689
|
+
);
|
|
690
|
+
const report = await readFile(path.join(runDir, "report.md"), "utf-8");
|
|
691
|
+
const restoreRaw = await safeRead(path.join(runDir, "restore.json"));
|
|
692
|
+
const qualityScore = qualityScoreRaw ? JSON.parse(qualityScoreRaw) : metrics.qualityScore ?? buildQualityScore(metrics.reviewReasons);
|
|
693
|
+
const transitionReport = transitionReportRaw ? JSON.parse(transitionReportRaw) : {
|
|
694
|
+
proposed: {},
|
|
695
|
+
applied: groupActionsByStatus(appliedActions)
|
|
696
|
+
};
|
|
697
|
+
return {
|
|
698
|
+
summary,
|
|
699
|
+
metrics,
|
|
700
|
+
qualityScore,
|
|
701
|
+
keptMemoryIds,
|
|
702
|
+
reviewQueue,
|
|
703
|
+
appliedActions,
|
|
704
|
+
transitionReport,
|
|
705
|
+
report,
|
|
706
|
+
manifest,
|
|
707
|
+
restore: restoreRaw ? JSON.parse(restoreRaw) : void 0
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export {
|
|
712
|
+
buildProposedActions,
|
|
713
|
+
buildQualityScore,
|
|
714
|
+
groupActionsByStatus,
|
|
715
|
+
runMemoryGovernance,
|
|
716
|
+
restoreMemoryGovernanceRun,
|
|
717
|
+
listMemoryGovernanceRuns,
|
|
718
|
+
readMemoryGovernanceRunArtifact
|
|
719
|
+
};
|
|
720
|
+
//# sourceMappingURL=chunk-J3BT33K7.js.map
|