@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,626 @@
|
|
|
1
|
+
// src/temporal-index.ts
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
var INDEX_VERSION = 1;
|
|
5
|
+
var TEMPORAL_INDEX_FILE = "index_time.json";
|
|
6
|
+
var TAG_INDEX_FILE = "index_tags.json";
|
|
7
|
+
var TAG_INDEX_VERSION = 2;
|
|
8
|
+
function stateDir(memoryDir) {
|
|
9
|
+
return path.join(memoryDir, "state");
|
|
10
|
+
}
|
|
11
|
+
function temporalIndexPath(memoryDir) {
|
|
12
|
+
return path.join(stateDir(memoryDir), TEMPORAL_INDEX_FILE);
|
|
13
|
+
}
|
|
14
|
+
function tagIndexPath(memoryDir) {
|
|
15
|
+
return path.join(stateDir(memoryDir), TAG_INDEX_FILE);
|
|
16
|
+
}
|
|
17
|
+
function ensureStateDir(memoryDir) {
|
|
18
|
+
const dir = stateDir(memoryDir);
|
|
19
|
+
if (!fs.existsSync(dir)) {
|
|
20
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function readJsonSafe(filePath, fallback) {
|
|
24
|
+
try {
|
|
25
|
+
const raw = fs.readFileSync(filePath, "utf8");
|
|
26
|
+
return JSON.parse(raw);
|
|
27
|
+
} catch {
|
|
28
|
+
return fallback;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function writeJsonSafe(filePath, data) {
|
|
32
|
+
try {
|
|
33
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), "utf8");
|
|
34
|
+
} catch {
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function writeJsonAtomic(filePath, data) {
|
|
38
|
+
const tmp = `${filePath}.tmp`;
|
|
39
|
+
try {
|
|
40
|
+
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), "utf8");
|
|
41
|
+
fs.renameSync(tmp, filePath);
|
|
42
|
+
} catch {
|
|
43
|
+
writeJsonSafe(filePath, data);
|
|
44
|
+
try {
|
|
45
|
+
fs.unlinkSync(tmp);
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function isoDateFromTimestamp(isoString) {
|
|
51
|
+
if (typeof isoString !== "string" || isoString.length < 10) {
|
|
52
|
+
console.warn(`[engram] temporal-index: malformed timestamp "${isoString}", falling back to today`);
|
|
53
|
+
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
54
|
+
}
|
|
55
|
+
return isoString.slice(0, 10);
|
|
56
|
+
}
|
|
57
|
+
function addPathToSet(record, key, p) {
|
|
58
|
+
if (!record[key]) {
|
|
59
|
+
record[key] = [];
|
|
60
|
+
}
|
|
61
|
+
if (!record[key].includes(p)) {
|
|
62
|
+
record[key].push(p);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function removePathFromSet(record, key, p) {
|
|
66
|
+
if (!record[key]) return;
|
|
67
|
+
record[key] = record[key].filter((x) => x !== p);
|
|
68
|
+
if (record[key].length === 0) {
|
|
69
|
+
delete record[key];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function normalizeTagSegment(segment) {
|
|
73
|
+
return segment.trim().toLowerCase().replace(/[_\s]+/g, "-").replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
74
|
+
}
|
|
75
|
+
function normalizeCanonicalTag(tag) {
|
|
76
|
+
return tag.trim().toLowerCase().replace(/\s*[>:|.]+\s*/g, "/").replace(/\s*\/\s*/g, "/").split("/").map(normalizeTagSegment).filter(Boolean).join("/");
|
|
77
|
+
}
|
|
78
|
+
function normalizeAliasKey(tag) {
|
|
79
|
+
return tag.trim().toLowerCase().replace(/[\/_.:-]+/g, " ").replace(/[-]+/g, " ").replace(/[^a-z0-9\s]+/g, " ").replace(/\s+/g, " ").trim();
|
|
80
|
+
}
|
|
81
|
+
function singularizeAlias(alias) {
|
|
82
|
+
if (!alias.endsWith("s") || alias.length <= 3) return null;
|
|
83
|
+
return alias.slice(0, -1);
|
|
84
|
+
}
|
|
85
|
+
function deriveParentTags(canonical) {
|
|
86
|
+
const parts = canonical.split("/").filter(Boolean);
|
|
87
|
+
const parents = [];
|
|
88
|
+
for (let i = parts.length - 1; i > 0; i -= 1) {
|
|
89
|
+
parents.push(parts.slice(0, i).join("/"));
|
|
90
|
+
}
|
|
91
|
+
return parents;
|
|
92
|
+
}
|
|
93
|
+
function deriveTagAliases(rawTag, canonical) {
|
|
94
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
95
|
+
const canonicalAlias = normalizeAliasKey(canonical);
|
|
96
|
+
const rawAlias = normalizeAliasKey(rawTag);
|
|
97
|
+
const leaf = canonical.split("/").at(-1) ?? canonical;
|
|
98
|
+
const leafAlias = normalizeAliasKey(leaf);
|
|
99
|
+
for (const candidate of [canonicalAlias, rawAlias, leafAlias]) {
|
|
100
|
+
if (!candidate) continue;
|
|
101
|
+
aliases.add(candidate);
|
|
102
|
+
const singular = singularizeAlias(candidate);
|
|
103
|
+
if (singular) aliases.add(singular);
|
|
104
|
+
}
|
|
105
|
+
return Array.from(aliases);
|
|
106
|
+
}
|
|
107
|
+
function normalizeTagIndex(raw) {
|
|
108
|
+
const normalized = {
|
|
109
|
+
version: TAG_INDEX_VERSION,
|
|
110
|
+
tags: {},
|
|
111
|
+
aliases: {}
|
|
112
|
+
};
|
|
113
|
+
if (!raw || typeof raw !== "object") {
|
|
114
|
+
return normalized;
|
|
115
|
+
}
|
|
116
|
+
const sourceTags = raw.tags ?? {};
|
|
117
|
+
for (const [rawCanonical, nodeOrPaths] of Object.entries(sourceTags)) {
|
|
118
|
+
const canonical = normalizeCanonicalTag(rawCanonical);
|
|
119
|
+
if (!canonical) continue;
|
|
120
|
+
const node = Array.isArray(nodeOrPaths) ? { paths: [...new Set(nodeOrPaths)] } : {
|
|
121
|
+
paths: Array.isArray(nodeOrPaths?.paths) ? [...new Set(nodeOrPaths.paths)] : [],
|
|
122
|
+
aliases: Array.isArray(nodeOrPaths?.aliases) ? [...new Set(nodeOrPaths.aliases)] : [],
|
|
123
|
+
parents: Array.isArray(nodeOrPaths?.parents) ? [...new Set(nodeOrPaths.parents)] : []
|
|
124
|
+
};
|
|
125
|
+
const existingNode = normalized.tags[canonical];
|
|
126
|
+
if (existingNode && !Array.isArray(existingNode)) {
|
|
127
|
+
existingNode.paths = [.../* @__PURE__ */ new Set([...existingNode.paths, ...node.paths])];
|
|
128
|
+
existingNode.aliases = [.../* @__PURE__ */ new Set([...existingNode.aliases ?? [], ...node.aliases ?? []])];
|
|
129
|
+
existingNode.parents = [.../* @__PURE__ */ new Set([...existingNode.parents ?? [], ...node.parents ?? []])];
|
|
130
|
+
} else if (Array.isArray(existingNode)) {
|
|
131
|
+
normalized.tags[canonical] = {
|
|
132
|
+
paths: [.../* @__PURE__ */ new Set([...existingNode, ...node.paths])],
|
|
133
|
+
aliases: [...new Set(node.aliases ?? [])],
|
|
134
|
+
parents: [...new Set(node.parents ?? deriveParentTags(canonical))]
|
|
135
|
+
};
|
|
136
|
+
} else {
|
|
137
|
+
normalized.tags[canonical] = node;
|
|
138
|
+
}
|
|
139
|
+
for (const alias of deriveTagAliases(canonical, canonical)) {
|
|
140
|
+
const list = normalized.aliases[alias] ?? [];
|
|
141
|
+
if (!list.includes(canonical)) list.push(canonical);
|
|
142
|
+
normalized.aliases[alias] = list;
|
|
143
|
+
}
|
|
144
|
+
for (const alias of node.aliases ?? []) {
|
|
145
|
+
const aliasKey = normalizeAliasKey(alias);
|
|
146
|
+
if (!aliasKey) continue;
|
|
147
|
+
const list = normalized.aliases[aliasKey] ?? [];
|
|
148
|
+
if (!list.includes(canonical)) list.push(canonical);
|
|
149
|
+
normalized.aliases[aliasKey] = list;
|
|
150
|
+
}
|
|
151
|
+
const mergedNode = normalized.tags[canonical];
|
|
152
|
+
if (mergedNode && !Array.isArray(mergedNode)) {
|
|
153
|
+
mergedNode.parents = [...new Set(mergedNode.parents ?? deriveParentTags(canonical))];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
for (const [alias, canonicals] of Object.entries(raw.aliases ?? {})) {
|
|
157
|
+
const aliasKey = normalizeAliasKey(alias);
|
|
158
|
+
if (!aliasKey) continue;
|
|
159
|
+
const list = normalized.aliases[aliasKey] ?? [];
|
|
160
|
+
for (const canonical of canonicals ?? []) {
|
|
161
|
+
const normalizedCanonical = normalizeCanonicalTag(canonical);
|
|
162
|
+
if (normalizedCanonical && !list.includes(normalizedCanonical)) {
|
|
163
|
+
list.push(normalizedCanonical);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
normalized.aliases[aliasKey] = list;
|
|
167
|
+
}
|
|
168
|
+
return normalized;
|
|
169
|
+
}
|
|
170
|
+
function ensureTagNode(index, canonical) {
|
|
171
|
+
const existing = index.tags[canonical];
|
|
172
|
+
if (existing && !Array.isArray(existing)) {
|
|
173
|
+
return existing;
|
|
174
|
+
}
|
|
175
|
+
const created = {
|
|
176
|
+
paths: Array.isArray(existing) ? [...new Set(existing)] : [],
|
|
177
|
+
aliases: [],
|
|
178
|
+
parents: deriveParentTags(canonical)
|
|
179
|
+
};
|
|
180
|
+
index.tags[canonical] = created;
|
|
181
|
+
return created;
|
|
182
|
+
}
|
|
183
|
+
function addTagGraphEntry(index, rawTag, memoryPath) {
|
|
184
|
+
const canonical = normalizeCanonicalTag(rawTag);
|
|
185
|
+
if (!canonical) return;
|
|
186
|
+
const node = ensureTagNode(index, canonical);
|
|
187
|
+
if (!node.paths.includes(memoryPath)) {
|
|
188
|
+
node.paths.push(memoryPath);
|
|
189
|
+
}
|
|
190
|
+
for (const alias of deriveTagAliases(rawTag, canonical)) {
|
|
191
|
+
const aliasKey = normalizeAliasKey(alias);
|
|
192
|
+
if (!aliasKey) continue;
|
|
193
|
+
if (!node.aliases?.includes(aliasKey)) {
|
|
194
|
+
node.aliases = [.../* @__PURE__ */ new Set([...node.aliases ?? [], aliasKey])];
|
|
195
|
+
}
|
|
196
|
+
const list = index.aliases?.[aliasKey] ?? [];
|
|
197
|
+
if (!list.includes(canonical)) {
|
|
198
|
+
index.aliases[aliasKey] = [...list, canonical];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function removeTagGraphEntry(index, rawTag, memoryPath) {
|
|
203
|
+
const canonical = normalizeCanonicalTag(rawTag);
|
|
204
|
+
if (!canonical) return;
|
|
205
|
+
const node = index.tags[canonical];
|
|
206
|
+
if (!node || Array.isArray(node)) return;
|
|
207
|
+
node.paths = node.paths.filter((value) => value !== memoryPath);
|
|
208
|
+
if (node.paths.length === 0) {
|
|
209
|
+
delete index.tags[canonical];
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function expandCanonicalTags(index, rawTags) {
|
|
213
|
+
const canonicals = /* @__PURE__ */ new Set();
|
|
214
|
+
for (const rawTag of rawTags) {
|
|
215
|
+
const canonical = normalizeCanonicalTag(rawTag);
|
|
216
|
+
if (canonical && index.tags[canonical]) {
|
|
217
|
+
canonicals.add(canonical);
|
|
218
|
+
}
|
|
219
|
+
const aliasKey = normalizeAliasKey(rawTag);
|
|
220
|
+
for (const resolved of index.aliases?.[aliasKey] ?? []) {
|
|
221
|
+
canonicals.add(resolved);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
225
|
+
for (const canonical of canonicals) {
|
|
226
|
+
expanded.add(canonical);
|
|
227
|
+
const node = index.tags[canonical];
|
|
228
|
+
if (node && !Array.isArray(node)) {
|
|
229
|
+
for (const parent of node.parents ?? []) {
|
|
230
|
+
expanded.add(parent);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return Array.from(expanded);
|
|
235
|
+
}
|
|
236
|
+
function aliasPhrase(alias) {
|
|
237
|
+
return alias.replace(/\//g, " ").replace(/-/g, " ").replace(/\s+/g, " ").trim();
|
|
238
|
+
}
|
|
239
|
+
function promptContainsAlias(prompt, alias) {
|
|
240
|
+
const phrase = aliasPhrase(alias);
|
|
241
|
+
if (!phrase) return false;
|
|
242
|
+
const normalizedPrompt = ` ${normalizeAliasKey(prompt)} `;
|
|
243
|
+
return normalizedPrompt.includes(` ${phrase} `);
|
|
244
|
+
}
|
|
245
|
+
function indexMemory(memoryDir, memoryPath, createdAt, tags) {
|
|
246
|
+
try {
|
|
247
|
+
ensureStateDir(memoryDir);
|
|
248
|
+
const tPath = temporalIndexPath(memoryDir);
|
|
249
|
+
const tIndex = readJsonSafe(tPath, { version: INDEX_VERSION, dates: {} });
|
|
250
|
+
const dateKey = isoDateFromTimestamp(createdAt);
|
|
251
|
+
addPathToSet(tIndex.dates, dateKey, memoryPath);
|
|
252
|
+
writeJsonAtomic(tPath, tIndex);
|
|
253
|
+
const gPath = tagIndexPath(memoryDir);
|
|
254
|
+
const gIndex = normalizeTagIndex(readJsonSafe(gPath, { version: TAG_INDEX_VERSION, tags: {}, aliases: {} }));
|
|
255
|
+
for (const tag of tags) {
|
|
256
|
+
if (tag && typeof tag === "string") {
|
|
257
|
+
addTagGraphEntry(gIndex, tag, memoryPath);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
writeJsonAtomic(gPath, gIndex);
|
|
261
|
+
} catch {
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function deindexMemory(memoryDir, memoryPath, createdAt, tags) {
|
|
265
|
+
try {
|
|
266
|
+
ensureStateDir(memoryDir);
|
|
267
|
+
const tPath = temporalIndexPath(memoryDir);
|
|
268
|
+
const tIndex = readJsonSafe(tPath, { version: INDEX_VERSION, dates: {} });
|
|
269
|
+
const dateKey = isoDateFromTimestamp(createdAt);
|
|
270
|
+
removePathFromSet(tIndex.dates, dateKey, memoryPath);
|
|
271
|
+
writeJsonAtomic(tPath, tIndex);
|
|
272
|
+
const gPath = tagIndexPath(memoryDir);
|
|
273
|
+
const gIndex = normalizeTagIndex(readJsonSafe(gPath, { version: TAG_INDEX_VERSION, tags: {}, aliases: {} }));
|
|
274
|
+
for (const tag of tags) {
|
|
275
|
+
if (tag && typeof tag === "string") {
|
|
276
|
+
removeTagGraphEntry(gIndex, tag, memoryPath);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
writeJsonAtomic(gPath, gIndex);
|
|
280
|
+
} catch {
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function clearIndexes(memoryDir) {
|
|
284
|
+
try {
|
|
285
|
+
ensureStateDir(memoryDir);
|
|
286
|
+
writeJsonAtomic(temporalIndexPath(memoryDir), { version: INDEX_VERSION, dates: {} });
|
|
287
|
+
writeJsonAtomic(tagIndexPath(memoryDir), { version: TAG_INDEX_VERSION, tags: {}, aliases: {} });
|
|
288
|
+
} catch {
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function indexesExist(memoryDir) {
|
|
292
|
+
try {
|
|
293
|
+
return fs.existsSync(temporalIndexPath(memoryDir)) && fs.existsSync(tagIndexPath(memoryDir));
|
|
294
|
+
} catch {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function indexMemoriesBatch(memoryDir, entries) {
|
|
299
|
+
if (entries.length === 0) return;
|
|
300
|
+
try {
|
|
301
|
+
ensureStateDir(memoryDir);
|
|
302
|
+
const tPath = temporalIndexPath(memoryDir);
|
|
303
|
+
const tIndex = readJsonSafe(tPath, { version: INDEX_VERSION, dates: {} });
|
|
304
|
+
const gPath = tagIndexPath(memoryDir);
|
|
305
|
+
const gIndex = normalizeTagIndex(readJsonSafe(gPath, { version: TAG_INDEX_VERSION, tags: {}, aliases: {} }));
|
|
306
|
+
for (const entry of entries) {
|
|
307
|
+
const dateKey = isoDateFromTimestamp(entry.createdAt);
|
|
308
|
+
addPathToSet(tIndex.dates, dateKey, entry.path);
|
|
309
|
+
for (const tag of entry.tags) {
|
|
310
|
+
if (tag && typeof tag === "string") {
|
|
311
|
+
addTagGraphEntry(gIndex, tag, entry.path);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
writeJsonAtomic(tPath, tIndex);
|
|
316
|
+
writeJsonAtomic(gPath, gIndex);
|
|
317
|
+
} catch {
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
async function queryByDateRangeAsync(memoryDir, fromDate, toDate) {
|
|
321
|
+
try {
|
|
322
|
+
const tPath = temporalIndexPath(memoryDir);
|
|
323
|
+
let raw;
|
|
324
|
+
try {
|
|
325
|
+
raw = await fs.promises.readFile(tPath, "utf8");
|
|
326
|
+
} catch {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
let tIndex;
|
|
330
|
+
try {
|
|
331
|
+
tIndex = JSON.parse(raw);
|
|
332
|
+
} catch {
|
|
333
|
+
tIndex = { version: INDEX_VERSION, dates: {} };
|
|
334
|
+
}
|
|
335
|
+
const end = toDate ?? new Date(Date.now() + 864e5).toISOString().slice(0, 10);
|
|
336
|
+
const results = /* @__PURE__ */ new Set();
|
|
337
|
+
for (const [date, paths] of Object.entries(tIndex.dates)) {
|
|
338
|
+
if (date >= fromDate && date < end) {
|
|
339
|
+
for (const p of paths) {
|
|
340
|
+
results.add(p);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return results;
|
|
345
|
+
} catch {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
async function queryByTagsAsync(memoryDir, tags) {
|
|
350
|
+
if (tags.length === 0) return null;
|
|
351
|
+
try {
|
|
352
|
+
const gPath = tagIndexPath(memoryDir);
|
|
353
|
+
let raw;
|
|
354
|
+
try {
|
|
355
|
+
raw = await fs.promises.readFile(gPath, "utf8");
|
|
356
|
+
} catch {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
let gIndex;
|
|
360
|
+
try {
|
|
361
|
+
gIndex = normalizeTagIndex(JSON.parse(raw));
|
|
362
|
+
} catch {
|
|
363
|
+
gIndex = { version: TAG_INDEX_VERSION, tags: {}, aliases: {} };
|
|
364
|
+
}
|
|
365
|
+
return queryByTagsFromIndex(gIndex, tags);
|
|
366
|
+
} catch {
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
function queryByTagsFromIndex(index, tags) {
|
|
371
|
+
const expandedTags = expandCanonicalTags(index, tags);
|
|
372
|
+
const results = /* @__PURE__ */ new Set();
|
|
373
|
+
for (const canonical of expandedTags) {
|
|
374
|
+
const nodeOrPaths = index.tags[canonical];
|
|
375
|
+
const paths = Array.isArray(nodeOrPaths) ? nodeOrPaths : nodeOrPaths?.paths ?? [];
|
|
376
|
+
for (const pathValue of paths) {
|
|
377
|
+
results.add(pathValue);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return results.size > 0 ? results : null;
|
|
381
|
+
}
|
|
382
|
+
function extractTagsFromPrompt(prompt) {
|
|
383
|
+
const found = /* @__PURE__ */ new Set();
|
|
384
|
+
const hashMatches = prompt.matchAll(/#([a-zA-Z][\w-]{1,30})/g);
|
|
385
|
+
for (const m of hashMatches) {
|
|
386
|
+
const canonical = normalizeCanonicalTag(m[1]);
|
|
387
|
+
if (canonical) found.add(canonical);
|
|
388
|
+
}
|
|
389
|
+
return Array.from(found);
|
|
390
|
+
}
|
|
391
|
+
async function resolvePromptTagPrefilterAsync(memoryDir, prompt) {
|
|
392
|
+
const explicitTags = extractTagsFromPrompt(prompt);
|
|
393
|
+
try {
|
|
394
|
+
const raw = await fs.promises.readFile(tagIndexPath(memoryDir), "utf8");
|
|
395
|
+
const tagIndex = normalizeTagIndex(JSON.parse(raw));
|
|
396
|
+
const matched = new Set(explicitTags);
|
|
397
|
+
for (const canonical of Object.keys(tagIndex.tags)) {
|
|
398
|
+
if (promptContainsAlias(prompt, canonical)) {
|
|
399
|
+
matched.add(canonical);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
for (const [alias, canonicals] of Object.entries(tagIndex.aliases ?? {})) {
|
|
403
|
+
if (!promptContainsAlias(prompt, alias)) continue;
|
|
404
|
+
for (const canonical of canonicals) {
|
|
405
|
+
matched.add(canonical);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
const expandedTags = expandCanonicalTags(tagIndex, Array.from(matched));
|
|
409
|
+
const paths = queryByTagsFromIndex(tagIndex, expandedTags);
|
|
410
|
+
return {
|
|
411
|
+
matchedTags: Array.from(matched),
|
|
412
|
+
expandedTags,
|
|
413
|
+
paths
|
|
414
|
+
};
|
|
415
|
+
} catch {
|
|
416
|
+
return { matchedTags: explicitTags, expandedTags: explicitTags, paths: null };
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function isTemporalQuery(prompt) {
|
|
420
|
+
return /\b(today|yesterday|this week|last week|this month|last month|recent(?:ly)?|lately|just now|earlier today|this morning|last night|last year|this year|\d+ days? ago|\d+ hours? ago|\d+ weeks? ago|\d+ months? ago|(?:in |on |during |since |before |after )?(?:january|february|march|april|may|june|july|august|september|october|november|december)(?:\s+\d{1,4})?|\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{2,4}|(?:spring|summer|fall|autumn|winter)\s+\d{4}|on the \d{1,2}(?:st|nd|rd|th)?|last (?:monday|tuesday|wednesday|thursday|friday|saturday|sunday))\b/i.test(
|
|
421
|
+
prompt
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
function recencyWindowFromPrompt(prompt, nowMs = Date.now()) {
|
|
425
|
+
const p = prompt.toLowerCase();
|
|
426
|
+
const now = new Date(nowMs);
|
|
427
|
+
let daysBack = 7;
|
|
428
|
+
if (/\btoday\b/.test(p) || /\bthis morning\b/.test(p) || /\bjust now\b/.test(p) || /\bearlier today\b/.test(p)) {
|
|
429
|
+
daysBack = 0;
|
|
430
|
+
} else if (/\byesterday\b/.test(p) || /\blast night\b/.test(p)) {
|
|
431
|
+
daysBack = 1;
|
|
432
|
+
} else if (/\bthis week\b/.test(p)) {
|
|
433
|
+
daysBack = 7;
|
|
434
|
+
} else if (/\blast week\b/.test(p)) {
|
|
435
|
+
daysBack = 14;
|
|
436
|
+
} else if (/\bthis month\b/.test(p)) {
|
|
437
|
+
daysBack = 31;
|
|
438
|
+
} else if (/\blast month\b/.test(p)) {
|
|
439
|
+
daysBack = 62;
|
|
440
|
+
} else if (/\bthis year\b/.test(p)) {
|
|
441
|
+
const jan1 = new Date(now.getFullYear(), 0, 1);
|
|
442
|
+
return jan1.toISOString().slice(0, 10);
|
|
443
|
+
} else if (/\blast year\b/.test(p)) {
|
|
444
|
+
const jan1LastYear = new Date(now.getFullYear() - 1, 0, 1);
|
|
445
|
+
return jan1LastYear.toISOString().slice(0, 10);
|
|
446
|
+
} else {
|
|
447
|
+
const monthNames = [
|
|
448
|
+
"january",
|
|
449
|
+
"february",
|
|
450
|
+
"march",
|
|
451
|
+
"april",
|
|
452
|
+
"may",
|
|
453
|
+
"june",
|
|
454
|
+
"july",
|
|
455
|
+
"august",
|
|
456
|
+
"september",
|
|
457
|
+
"october",
|
|
458
|
+
"november",
|
|
459
|
+
"december"
|
|
460
|
+
];
|
|
461
|
+
const monthMatch = p.match(/\b(january|february|march|april|may|june|july|august|september|october|november|december)(?:\s+(\d{4}))?\b/);
|
|
462
|
+
if (monthMatch) {
|
|
463
|
+
const monthIdx = monthNames.indexOf(monthMatch[1]);
|
|
464
|
+
const year = monthMatch[2] ? parseInt(monthMatch[2], 10) : now.getFullYear();
|
|
465
|
+
if (/\bbefore\b/.test(p)) {
|
|
466
|
+
if (monthMatch[2]) {
|
|
467
|
+
const monthStart = new Date(year, monthIdx, 1);
|
|
468
|
+
return new Date(monthStart.getTime() - 730 * 864e5).toISOString().slice(0, 10);
|
|
469
|
+
}
|
|
470
|
+
daysBack = 730;
|
|
471
|
+
} else {
|
|
472
|
+
const monthStart = new Date(year, monthIdx, 1);
|
|
473
|
+
return monthStart.toISOString().slice(0, 10);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const weekMatch = p.match(/(\d{1,5})\s*weeks?\s*ago/);
|
|
477
|
+
if (weekMatch) {
|
|
478
|
+
daysBack = Math.min(365, parseInt(weekMatch[1], 10) * 7);
|
|
479
|
+
} else {
|
|
480
|
+
const monthsAgoMatch = p.match(/(\d{1,5})\s*months?\s*ago/);
|
|
481
|
+
if (monthsAgoMatch) {
|
|
482
|
+
daysBack = Math.min(730, parseInt(monthsAgoMatch[1], 10) * 31);
|
|
483
|
+
} else {
|
|
484
|
+
const numMatch = p.match(/(\d{1,5})\s*days?\s*ago/);
|
|
485
|
+
if (numMatch) {
|
|
486
|
+
daysBack = Math.min(365, parseInt(numMatch[1], 10));
|
|
487
|
+
} else {
|
|
488
|
+
const hrMatch = p.match(/(\d{1,5})\s*hours?\s*ago/);
|
|
489
|
+
if (hrMatch) {
|
|
490
|
+
daysBack = Math.max(1, Math.ceil(parseInt(hrMatch[1], 10) / 24));
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
const isoMatch = p.match(/(\d{4})-(\d{2})-(\d{2})/);
|
|
496
|
+
if (isoMatch) {
|
|
497
|
+
return `${isoMatch[1]}-${isoMatch[2]}-${isoMatch[3]}`;
|
|
498
|
+
}
|
|
499
|
+
const usMatch = p.match(/(\d{1,2})\/(\d{1,2})\/(\d{2,4})/);
|
|
500
|
+
if (usMatch) {
|
|
501
|
+
const year = usMatch[3].length === 2 ? 2e3 + parseInt(usMatch[3], 10) : parseInt(usMatch[3], 10);
|
|
502
|
+
return `${year}-${usMatch[1].padStart(2, "0")}-${usMatch[2].padStart(2, "0")}`;
|
|
503
|
+
}
|
|
504
|
+
const dayOfWeekMatch = p.match(/\blast\s+(monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/);
|
|
505
|
+
if (dayOfWeekMatch) {
|
|
506
|
+
const dayNames = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
507
|
+
const targetDay = dayNames.indexOf(dayOfWeekMatch[1]);
|
|
508
|
+
const currentDay = now.getDay();
|
|
509
|
+
daysBack = (currentDay - targetDay + 7) % 7 || 7;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
const from = new Date(nowMs - daysBack * 24 * 60 * 60 * 1e3);
|
|
513
|
+
return from.toISOString().slice(0, 10);
|
|
514
|
+
}
|
|
515
|
+
function recencyWindowBoundsFromPrompt(prompt, nowMs = Date.now()) {
|
|
516
|
+
const fromDate = recencyWindowFromPrompt(prompt, nowMs);
|
|
517
|
+
const p = prompt.toLowerCase();
|
|
518
|
+
const now = new Date(nowMs);
|
|
519
|
+
const today = now.toISOString().slice(0, 10);
|
|
520
|
+
const tomorrow = new Date(nowMs + 864e5).toISOString().slice(0, 10);
|
|
521
|
+
let toDate;
|
|
522
|
+
if (/\btoday\b|\bthis morning\b|\bjust now\b|\bearlier today\b/.test(p)) {
|
|
523
|
+
toDate = tomorrow;
|
|
524
|
+
} else if (/\byesterday\b|\blast night\b/.test(p)) {
|
|
525
|
+
toDate = today;
|
|
526
|
+
} else if (/\bthis week\b|\bthis month\b|\bthis year\b/.test(p)) {
|
|
527
|
+
toDate = tomorrow;
|
|
528
|
+
} else if (/\blast week\b/.test(p)) {
|
|
529
|
+
toDate = new Date(nowMs - 7 * 864e5).toISOString().slice(0, 10);
|
|
530
|
+
} else if (/\blast month\b/.test(p)) {
|
|
531
|
+
toDate = new Date(nowMs - 31 * 864e5).toISOString().slice(0, 10);
|
|
532
|
+
} else if (/\blast year\b/.test(p)) {
|
|
533
|
+
toDate = `${now.getFullYear()}-01-01`;
|
|
534
|
+
} else {
|
|
535
|
+
const monthNames = [
|
|
536
|
+
"january",
|
|
537
|
+
"february",
|
|
538
|
+
"march",
|
|
539
|
+
"april",
|
|
540
|
+
"may",
|
|
541
|
+
"june",
|
|
542
|
+
"july",
|
|
543
|
+
"august",
|
|
544
|
+
"september",
|
|
545
|
+
"october",
|
|
546
|
+
"november",
|
|
547
|
+
"december"
|
|
548
|
+
];
|
|
549
|
+
const monthMatch = p.match(/\b(january|february|march|april|may|june|july|august|september|october|november|december)(?:\s+(\d{4}))?\b/);
|
|
550
|
+
if (monthMatch) {
|
|
551
|
+
const monthIdx = monthNames.indexOf(monthMatch[1]);
|
|
552
|
+
const year = monthMatch[2] ? parseInt(monthMatch[2], 10) : now.getFullYear();
|
|
553
|
+
const isSinceOrAfter = /\b(since|after)\b/.test(p);
|
|
554
|
+
const isBefore = /\bbefore\b/.test(p);
|
|
555
|
+
if (isSinceOrAfter) {
|
|
556
|
+
toDate = tomorrow;
|
|
557
|
+
} else if (isBefore) {
|
|
558
|
+
toDate = new Date(year, monthIdx, 1).toISOString().slice(0, 10);
|
|
559
|
+
} else {
|
|
560
|
+
toDate = new Date(year, monthIdx + 1, 1).toISOString().slice(0, 10);
|
|
561
|
+
}
|
|
562
|
+
} else {
|
|
563
|
+
let toDaysBack = -1;
|
|
564
|
+
const weekMatch = p.match(/(\d{1,5})\s*weeks?\s*ago/);
|
|
565
|
+
if (weekMatch) {
|
|
566
|
+
toDaysBack = Math.max(0, Math.min(52, parseInt(weekMatch[1], 10)) - 1) * 7;
|
|
567
|
+
} else {
|
|
568
|
+
const monthsAgoMatch = p.match(/(\d{1,5})\s*months?\s*ago/);
|
|
569
|
+
if (monthsAgoMatch) {
|
|
570
|
+
toDaysBack = Math.max(0, Math.min(24, parseInt(monthsAgoMatch[1], 10)) - 1) * 31;
|
|
571
|
+
} else {
|
|
572
|
+
const numMatch = p.match(/(\d{1,5})\s*days?\s*ago/);
|
|
573
|
+
if (numMatch) {
|
|
574
|
+
toDaysBack = Math.max(0, Math.min(365, parseInt(numMatch[1], 10)) - 1);
|
|
575
|
+
} else {
|
|
576
|
+
const hrMatch = p.match(/(\d{1,5})\s*hours?\s*ago/);
|
|
577
|
+
if (hrMatch) {
|
|
578
|
+
toDaysBack = -1;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
const isoMatch = p.match(/(\d{4})-(\d{2})-(\d{2})/);
|
|
584
|
+
if (isoMatch) {
|
|
585
|
+
const d = /* @__PURE__ */ new Date(`${isoMatch[1]}-${isoMatch[2]}-${isoMatch[3]}T00:00:00Z`);
|
|
586
|
+
toDate = new Date(d.getTime() + 864e5).toISOString().slice(0, 10);
|
|
587
|
+
} else {
|
|
588
|
+
const usMatch = p.match(/(\d{1,2})\/(\d{1,2})\/(\d{2,4})/);
|
|
589
|
+
if (usMatch) {
|
|
590
|
+
const year = usMatch[3].length === 2 ? 2e3 + parseInt(usMatch[3], 10) : parseInt(usMatch[3], 10);
|
|
591
|
+
const d = /* @__PURE__ */ new Date(`${year}-${usMatch[1].padStart(2, "0")}-${usMatch[2].padStart(2, "0")}T00:00:00Z`);
|
|
592
|
+
toDate = new Date(d.getTime() + 864e5).toISOString().slice(0, 10);
|
|
593
|
+
} else {
|
|
594
|
+
const dayOfWeekMatch = p.match(/\blast\s+(monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/);
|
|
595
|
+
if (dayOfWeekMatch) {
|
|
596
|
+
const dayNames = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
597
|
+
const targetDay = dayNames.indexOf(dayOfWeekMatch[1]);
|
|
598
|
+
const currentDay = now.getDay();
|
|
599
|
+
const daysBack = (currentDay - targetDay + 7) % 7 || 7;
|
|
600
|
+
toDate = new Date(nowMs - (daysBack - 1) * 864e5).toISOString().slice(0, 10);
|
|
601
|
+
} else {
|
|
602
|
+
toDate = toDaysBack < 0 ? tomorrow : new Date(nowMs - toDaysBack * 864e5).toISOString().slice(0, 10);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
if (toDate <= fromDate) toDate = tomorrow;
|
|
609
|
+
return { fromDate, toDate };
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
export {
|
|
613
|
+
indexMemory,
|
|
614
|
+
deindexMemory,
|
|
615
|
+
clearIndexes,
|
|
616
|
+
indexesExist,
|
|
617
|
+
indexMemoriesBatch,
|
|
618
|
+
queryByDateRangeAsync,
|
|
619
|
+
queryByTagsAsync,
|
|
620
|
+
extractTagsFromPrompt,
|
|
621
|
+
resolvePromptTagPrefilterAsync,
|
|
622
|
+
isTemporalQuery,
|
|
623
|
+
recencyWindowFromPrompt,
|
|
624
|
+
recencyWindowBoundsFromPrompt
|
|
625
|
+
};
|
|
626
|
+
//# sourceMappingURL=chunk-V3RXWQIE.js.map
|