@remnic/core 1.0.2 → 1.0.3
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/access-cli.d.ts +13 -3
- package/dist/access-cli.js +90 -75
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +10 -3
- package/dist/access-http.js +25 -18
- package/dist/access-mcp.d.ts +30 -3
- package/dist/access-mcp.js +16 -1
- package/dist/access-schema.d.ts +12 -12
- package/dist/access-schema.js +1 -1
- package/dist/access-service.d.ts +65 -4
- package/dist/access-service.js +21 -15
- package/dist/active-memory-bridge.d.ts +66 -0
- package/dist/active-memory-bridge.js +11 -0
- package/dist/active-recall.d.ts +96 -0
- package/dist/active-recall.js +308 -0
- package/dist/active-recall.js.map +1 -0
- package/dist/behavior-learner.js +1 -1
- package/dist/bootstrap.d.ts +6 -3
- package/dist/bootstrap.js +2 -2
- package/dist/boxes.js +2 -2
- package/dist/briefing.d.ts +169 -0
- package/dist/briefing.js +52 -0
- package/dist/briefing.js.map +1 -0
- package/dist/buffer.d.ts +19 -5
- package/dist/buffer.js +2 -2
- package/dist/calibration.js +6 -6
- package/dist/causal-behavior.js +5 -5
- package/dist/causal-chain.js +3 -3
- package/dist/causal-consolidation.d.ts +22 -2
- package/dist/causal-consolidation.js +36 -9
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +6 -6
- package/dist/causal-trajectory-graph.js +1 -1
- package/dist/causal-trajectory.d.ts +14 -1
- package/dist/causal-trajectory.js +5 -1
- package/dist/{chunk-KWBU5S5U.js → chunk-2ODBA7MQ.js} +9 -3
- package/dist/chunk-2ODBA7MQ.js.map +1 -0
- package/dist/{chunk-6UJQNRIO.js → chunk-2VFW5K5U.js} +93 -36
- package/dist/chunk-2VFW5K5U.js.map +1 -0
- package/dist/chunk-3PG3H5TD.js +7 -0
- package/dist/chunk-3PG3H5TD.js.map +1 -0
- package/dist/{chunk-NTTLPF7F.js → chunk-3QFQGRHO.js} +5 -5
- package/dist/chunk-4DJQYKMN.js +187 -0
- package/dist/chunk-4DJQYKMN.js.map +1 -0
- package/dist/chunk-4KAN3GZ3.js +225 -0
- package/dist/chunk-4KAN3GZ3.js.map +1 -0
- package/dist/{chunk-ORZMT74A.js → chunk-4NRAJUDS.js} +11 -1
- package/dist/chunk-4NRAJUDS.js.map +1 -0
- package/dist/{chunk-B7LOFDVE.js → chunk-4WMCPJWX.js} +8 -3
- package/dist/chunk-4WMCPJWX.js.map +1 -0
- package/dist/{chunk-G3AG3KZN.js → chunk-5IZL4DCV.js} +2 -2
- package/dist/{chunk-BRK4ODMI.js → chunk-5NPGSAVB.js} +2 -2
- package/dist/chunk-6MKAMLQL.js +16 -0
- package/dist/chunk-6MKAMLQL.js.map +1 -0
- package/dist/{chunk-ESSMF2FR.js → chunk-6PFRXT4K.js} +15 -6
- package/dist/chunk-6PFRXT4K.js.map +1 -0
- package/dist/chunk-6ZH4TU6I.js +245 -0
- package/dist/chunk-6ZH4TU6I.js.map +1 -0
- package/dist/{chunk-V4YC4LUK.js → chunk-74JR4N5J.js} +175 -63
- package/dist/chunk-74JR4N5J.js.map +1 -0
- package/dist/{chunk-L5RPWGFK.js → chunk-7DHTMOND.js} +2 -2
- package/dist/{chunk-TVVVQQAK.js → chunk-7PA4OZEU.js} +53 -11
- package/dist/chunk-7PA4OZEU.js.map +1 -0
- package/dist/{chunk-Q6FETXJA.js → chunk-7SEAZFFB.js} +2 -2
- package/dist/chunk-ALXMCZEU.js +332 -0
- package/dist/chunk-ALXMCZEU.js.map +1 -0
- package/dist/{chunk-QANCTXQF.js → chunk-AYPYCLR7.js} +3 -3
- package/dist/{chunk-WWIQTB2Y.js → chunk-BKQJBXXX.js} +9 -2
- package/dist/chunk-BKQJBXXX.js.map +1 -0
- package/dist/{chunk-LP47L3ZX.js → chunk-BTY5RRRF.js} +7 -7
- package/dist/{chunk-SCHEKPYH.js → chunk-C2EFFULQ.js} +1 -1
- package/dist/{chunk-GJR6D6KC.js → chunk-D654IBA6.js} +2 -2
- package/dist/{chunk-UV2FO7J4.js → chunk-E6K4NIEU.js} +2 -2
- package/dist/{chunk-T4WRIV2C.js → chunk-EABGC2TL.js} +2 -2
- package/dist/chunk-ECKDIK5F.js +813 -0
- package/dist/chunk-ECKDIK5F.js.map +1 -0
- package/dist/chunk-EJI5XIBB.js +232 -0
- package/dist/chunk-EJI5XIBB.js.map +1 -0
- package/dist/{chunk-ONRU4L2N.js → chunk-FEMOX5AD.js} +2 -2
- package/dist/{chunk-IFFFR3MR.js → chunk-FSFEQI74.js} +3 -3
- package/dist/chunk-G4SK7DSQ.js +121 -0
- package/dist/chunk-G4SK7DSQ.js.map +1 -0
- package/dist/{chunk-UIYZ5T3I.js → chunk-GJQPH5G3.js} +8 -8
- package/dist/{chunk-2PO5ZRKV.js → chunk-GZCUW5IC.js} +16 -3
- package/dist/chunk-GZCUW5IC.js.map +1 -0
- package/dist/{chunk-IZME7KW2.js → chunk-HITJFT7E.js} +24 -10
- package/dist/{chunk-IZME7KW2.js.map → chunk-HITJFT7E.js.map} +1 -1
- package/dist/chunk-IQT3XTKW.js +121 -0
- package/dist/chunk-IQT3XTKW.js.map +1 -0
- package/dist/{chunk-BDFZXRSO.js → chunk-J4IYOZZ5.js} +15 -2
- package/dist/chunk-J4IYOZZ5.js.map +1 -0
- package/dist/{chunk-ZKYI7UVO.js → chunk-JR4ZC3G4.js} +2 -2
- package/dist/{chunk-UCYSTFZR.js → chunk-JRNQ3RNA.js} +2 -2
- package/dist/{chunk-UYSKNO6E.js → chunk-JROGC36Y.js} +15 -4
- package/dist/chunk-JROGC36Y.js.map +1 -0
- package/dist/{chunk-GPGBSNKM.js → chunk-K4FLSOR5.js} +2 -2
- package/dist/{chunk-M5ZBBBJI.js → chunk-KEG4GNGI.js} +2 -2
- package/dist/chunk-KVE7R4CG.js +320 -0
- package/dist/chunk-KVE7R4CG.js.map +1 -0
- package/dist/{chunk-L7WO3MZ4.js → chunk-KWP7T3DP.js} +2 -2
- package/dist/chunk-LAYN4LDC.js +267 -0
- package/dist/chunk-LAYN4LDC.js.map +1 -0
- package/dist/{chunk-PGK3VUHN.js → chunk-MTLYEMJB.js} +3 -2
- package/dist/chunk-MTLYEMJB.js.map +1 -0
- package/dist/{chunk-J47FNDR7.js → chunk-MYQWXITD.js} +7 -7
- package/dist/{chunk-YNI4S5WT.js → chunk-N53K2EXC.js} +2 -2
- package/dist/{chunk-763GUIOU.js → chunk-NBNN5GOB.js} +2 -2
- package/dist/{chunk-CXWFUJR2.js → chunk-NSB3WSYS.js} +125 -6
- package/dist/chunk-NSB3WSYS.js.map +1 -0
- package/dist/{chunk-KL4CP4SB.js → chunk-O5ETUNBT.js} +17 -5
- package/dist/chunk-O5ETUNBT.js.map +1 -0
- package/dist/{chunk-OOSWAUYB.js → chunk-ODWDQNRE.js} +2 -2
- package/dist/{chunk-ISY75RLM.js → chunk-OJFGVJS6.js} +288 -7
- package/dist/chunk-OJFGVJS6.js.map +1 -0
- package/dist/{chunk-HLBYLYRD.js → chunk-PAORGQRI.js} +70 -13
- package/dist/chunk-PAORGQRI.js.map +1 -0
- package/dist/{chunk-ZJLY4QSU.js → chunk-PMB3WGDL.js} +69 -6
- package/dist/chunk-PMB3WGDL.js.map +1 -0
- package/dist/{chunk-J3BT33K7.js → chunk-POBPGDWI.js} +5 -5
- package/dist/{chunk-QWUUMMIK.js → chunk-POMSFKTB.js} +1351 -76
- package/dist/chunk-POMSFKTB.js.map +1 -0
- package/dist/{chunk-OTAVQCSF.js → chunk-PYXS46O7.js} +2 -2
- package/dist/chunk-QDW3E4RD.js +108 -0
- package/dist/chunk-QDW3E4RD.js.map +1 -0
- package/dist/{chunk-YNCQ7E4M.js → chunk-QDYXG4CS.js} +4 -3
- package/dist/chunk-QDYXG4CS.js.map +1 -0
- package/dist/{chunk-XUHI52HK.js → chunk-QKAH5B6E.js} +4 -4
- package/dist/{chunk-HLXVTBF3.js → chunk-QNJMBKFK.js} +3 -2
- package/dist/chunk-QNJMBKFK.js.map +1 -0
- package/dist/chunk-RCICHSHL.js +789 -0
- package/dist/chunk-RCICHSHL.js.map +1 -0
- package/dist/{chunk-HG2NKWR2.js → chunk-S4LX5EBI.js} +2 -2
- package/dist/{chunk-4A24LIM2.js → chunk-S75M5ZRK.js} +2 -2
- package/dist/{chunk-QCCCQT3O.js → chunk-TBBDFYXW.js} +2 -2
- package/dist/chunk-TBBDFYXW.js.map +1 -0
- package/dist/{chunk-U4PV25RD.js → chunk-U2IQTSBY.js} +1 -1
- package/dist/chunk-U2IQTSBY.js.map +1 -0
- package/dist/chunk-U66YHYC7.js +31 -0
- package/dist/chunk-U66YHYC7.js.map +1 -0
- package/dist/{chunk-MWGVGUIS.js → chunk-UEYA6UC7.js} +36 -4
- package/dist/chunk-UEYA6UC7.js.map +1 -0
- package/dist/{chunk-MDDAA2AO.js → chunk-UPMD5XND.js} +2 -2
- package/dist/{chunk-M5KEYE5E.js → chunk-URB2WSKZ.js} +2 -2
- package/dist/chunk-UVJFDP7P.js +202 -0
- package/dist/chunk-UVJFDP7P.js.map +1 -0
- package/dist/{chunk-QY2BHY5O.js → chunk-V7XCAHIB.js} +265 -25
- package/dist/chunk-V7XCAHIB.js.map +1 -0
- package/dist/chunk-W6SL7OFG.js +180 -0
- package/dist/chunk-W6SL7OFG.js.map +1 -0
- package/dist/{chunk-QDOSNLB4.js → chunk-X4WESCKA.js} +17 -15
- package/dist/chunk-X4WESCKA.js.map +1 -0
- package/dist/{chunk-OTFNI3OO.js → chunk-XMGSSBFX.js} +1738 -383
- package/dist/chunk-XMGSSBFX.js.map +1 -0
- package/dist/chunk-YDBIWGNI.js +298 -0
- package/dist/chunk-YDBIWGNI.js.map +1 -0
- package/dist/chunk-YFYL2SIJ.js +7857 -0
- package/dist/chunk-YFYL2SIJ.js.map +1 -0
- package/dist/chunking.js +1 -1
- package/dist/citations.d.ts +67 -0
- package/dist/citations.js +13 -0
- package/dist/citations.js.map +1 -0
- package/dist/cli-DwIBnp2g.d.ts +1240 -0
- package/dist/cli.d.ts +31 -1147
- package/dist/cli.js +149 -7092
- package/dist/cli.js.map +1 -1
- package/dist/codex-materialize-CQlLTzke.d.ts +139 -0
- package/dist/codex-thread-key.d.ts +3 -0
- package/dist/codex-thread-key.js +7 -0
- package/dist/codex-thread-key.js.map +1 -0
- package/dist/config.js +3 -2
- package/dist/connectors/codex/instructions.md +160 -0
- package/dist/connectors/codex/resources/namespace-cheatsheet.md +48 -0
- package/dist/day-summary.d.ts +7 -2
- package/dist/day-summary.js +5 -2
- package/dist/embedding-fallback.d.ts +96 -2
- package/dist/embedding-fallback.js +6 -4
- package/dist/{engine-2A6J4XEX.js → engine-X7X3AAG3.js} +10 -7
- package/dist/engine-X7X3AAG3.js.map +1 -0
- package/dist/entity-retrieval.d.ts +3 -2
- package/dist/entity-retrieval.js +10 -7
- package/dist/entity-schema.d.ts +11 -0
- package/dist/entity-schema.js +19 -0
- package/dist/entity-schema.js.map +1 -0
- package/dist/explicit-capture.d.ts +6 -3
- package/dist/explicit-capture.js +2 -2
- package/dist/extraction-judge.d.ts +66 -0
- package/dist/extraction-judge.js +18 -0
- package/dist/extraction-judge.js.map +1 -0
- package/dist/extraction.d.ts +1 -0
- package/dist/extraction.js +12 -10
- package/dist/fallback-llm.js +4 -4
- package/dist/graph.js +1 -1
- package/dist/importance.d.ts +11 -1
- package/dist/importance.js +3 -1
- package/dist/index.d.ts +1140 -8
- package/dist/index.js +3350 -333
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +2 -1
- package/dist/intent.js +3 -1
- package/dist/lifecycle.js +1 -1
- package/dist/local-llm.js +2 -2
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +1 -1
- package/dist/memory-cache.d.ts +2 -2
- package/dist/memory-cache.js +1 -1
- package/dist/{memory-projection-store-NxMkbocT.d.ts → memory-projection-store-DeSXPh1j.d.ts} +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/model-registry.js +2 -2
- package/dist/models-json.js +2 -2
- package/dist/native-knowledge.js +2 -2
- package/dist/negative.js +2 -2
- package/dist/operator-toolkit.js +20 -16
- package/dist/{orchestrator-zTa-Qo-1.d.ts → orchestrator-B9kwlCep.d.ts} +252 -7
- package/dist/orchestrator.d.ts +6 -3
- package/dist/orchestrator.js +70 -58
- package/dist/page-versioning.d.ts +77 -0
- package/dist/page-versioning.js +15 -0
- package/dist/page-versioning.js.map +1 -0
- package/dist/plugin-id.d.ts +37 -0
- package/dist/plugin-id.js +11 -0
- package/dist/plugin-id.js.map +1 -0
- package/dist/policy-runtime.js +2 -2
- package/dist/profiling.js +2 -2
- package/dist/qmd.d.ts +5 -2
- package/dist/qmd.js +3 -3
- package/dist/recall-audit.d.ts +20 -0
- package/dist/recall-audit.js +50 -0
- package/dist/recall-audit.js.map +1 -0
- package/dist/recall-mmr.d.ts +152 -0
- package/dist/recall-mmr.js +17 -0
- package/dist/recall-mmr.js.map +1 -0
- package/dist/recall-qos.js +2 -2
- package/dist/recall-state.js +2 -2
- package/dist/relevance.js +2 -2
- package/dist/resolve-provider-secret.js +2 -2
- package/dist/resume-bundles.js +5 -4
- package/dist/retrieval-agents.js +2 -2
- package/dist/retrieval.js +2 -2
- package/dist/schemas.d.ts +398 -40
- package/dist/schemas.js +3 -1
- package/dist/sdk-compat.d.ts +2 -0
- package/dist/sdk-compat.js +6 -3
- package/dist/sdk-compat.js.map +1 -1
- package/dist/semantic-chunking.d.ts +87 -0
- package/dist/semantic-chunking.js +20 -0
- package/dist/semantic-chunking.js.map +1 -0
- package/dist/semantic-consolidation-DrvSYRdB.d.ts +119 -0
- package/dist/semantic-consolidation.d.ts +4 -42
- package/dist/semantic-consolidation.js +23 -2
- package/dist/semantic-rule-promotion.js +9 -6
- package/dist/semantic-rule-verifier.js +10 -7
- package/dist/session-observer-state.js +2 -2
- package/dist/session-toggles.d.ts +22 -0
- package/dist/session-toggles.js +116 -0
- package/dist/session-toggles.js.map +1 -0
- package/dist/skills-registry.d.ts +47 -0
- package/dist/skills-registry.js +48 -0
- package/dist/skills-registry.js.map +1 -0
- package/dist/source-attribution.d.ts +169 -0
- package/dist/source-attribution.js +27 -0
- package/dist/source-attribution.js.map +1 -0
- package/dist/storage.d.ts +171 -10
- package/dist/storage.js +16 -5
- package/dist/summarizer.js +7 -7
- package/dist/temporal-supersession.d.ts +127 -0
- package/dist/temporal-supersession.js +20 -0
- package/dist/temporal-supersession.js.map +1 -0
- package/dist/threading.js +2 -2
- package/dist/tier-migration.d.ts +2 -1
- package/dist/tier-routing.js +2 -2
- package/dist/tokens.d.ts +21 -1
- package/dist/tokens.js +5 -1
- package/dist/transcript.js +2 -2
- package/dist/types.d.ts +497 -3
- package/dist/types.js +1 -1
- package/dist/utility-learner.js +2 -2
- package/dist/utility-runtime.js +3 -3
- package/dist/verified-recall.js +11 -8
- package/dist/whitespace.d.ts +4 -0
- package/dist/whitespace.js +9 -0
- package/dist/whitespace.js.map +1 -0
- package/package.json +14 -8
- package/dist/chunk-2CJCWDMR.js +0 -87
- package/dist/chunk-2CJCWDMR.js.map +0 -1
- package/dist/chunk-2PO5ZRKV.js.map +0 -1
- package/dist/chunk-6UJQNRIO.js.map +0 -1
- package/dist/chunk-B7LOFDVE.js.map +0 -1
- package/dist/chunk-BDFZXRSO.js.map +0 -1
- package/dist/chunk-CXWFUJR2.js.map +0 -1
- package/dist/chunk-DORBM6OB.js +0 -81
- package/dist/chunk-DORBM6OB.js.map +0 -1
- package/dist/chunk-ESSMF2FR.js.map +0 -1
- package/dist/chunk-HLBYLYRD.js.map +0 -1
- package/dist/chunk-HLXVTBF3.js.map +0 -1
- package/dist/chunk-ISY75RLM.js.map +0 -1
- package/dist/chunk-KL4CP4SB.js.map +0 -1
- package/dist/chunk-KWBU5S5U.js.map +0 -1
- package/dist/chunk-MWGVGUIS.js.map +0 -1
- package/dist/chunk-ORZMT74A.js.map +0 -1
- package/dist/chunk-OTFNI3OO.js.map +0 -1
- package/dist/chunk-PGK3VUHN.js.map +0 -1
- package/dist/chunk-QCCCQT3O.js.map +0 -1
- package/dist/chunk-QDOSNLB4.js.map +0 -1
- package/dist/chunk-QPKFPHOO.js +0 -178
- package/dist/chunk-QPKFPHOO.js.map +0 -1
- package/dist/chunk-QWUUMMIK.js.map +0 -1
- package/dist/chunk-QY2BHY5O.js.map +0 -1
- package/dist/chunk-TVVVQQAK.js.map +0 -1
- package/dist/chunk-U4PV25RD.js.map +0 -1
- package/dist/chunk-UYSKNO6E.js.map +0 -1
- package/dist/chunk-V4YC4LUK.js.map +0 -1
- package/dist/chunk-WWIQTB2Y.js.map +0 -1
- package/dist/chunk-YNCQ7E4M.js.map +0 -1
- package/dist/chunk-ZJLY4QSU.js.map +0 -1
- /package/dist/{engine-2A6J4XEX.js.map → active-memory-bridge.js.map} +0 -0
- /package/dist/{chunk-NTTLPF7F.js.map → chunk-3QFQGRHO.js.map} +0 -0
- /package/dist/{chunk-G3AG3KZN.js.map → chunk-5IZL4DCV.js.map} +0 -0
- /package/dist/{chunk-BRK4ODMI.js.map → chunk-5NPGSAVB.js.map} +0 -0
- /package/dist/{chunk-L5RPWGFK.js.map → chunk-7DHTMOND.js.map} +0 -0
- /package/dist/{chunk-Q6FETXJA.js.map → chunk-7SEAZFFB.js.map} +0 -0
- /package/dist/{chunk-QANCTXQF.js.map → chunk-AYPYCLR7.js.map} +0 -0
- /package/dist/{chunk-LP47L3ZX.js.map → chunk-BTY5RRRF.js.map} +0 -0
- /package/dist/{chunk-SCHEKPYH.js.map → chunk-C2EFFULQ.js.map} +0 -0
- /package/dist/{chunk-GJR6D6KC.js.map → chunk-D654IBA6.js.map} +0 -0
- /package/dist/{chunk-UV2FO7J4.js.map → chunk-E6K4NIEU.js.map} +0 -0
- /package/dist/{chunk-T4WRIV2C.js.map → chunk-EABGC2TL.js.map} +0 -0
- /package/dist/{chunk-ONRU4L2N.js.map → chunk-FEMOX5AD.js.map} +0 -0
- /package/dist/{chunk-IFFFR3MR.js.map → chunk-FSFEQI74.js.map} +0 -0
- /package/dist/{chunk-UIYZ5T3I.js.map → chunk-GJQPH5G3.js.map} +0 -0
- /package/dist/{chunk-ZKYI7UVO.js.map → chunk-JR4ZC3G4.js.map} +0 -0
- /package/dist/{chunk-UCYSTFZR.js.map → chunk-JRNQ3RNA.js.map} +0 -0
- /package/dist/{chunk-GPGBSNKM.js.map → chunk-K4FLSOR5.js.map} +0 -0
- /package/dist/{chunk-M5ZBBBJI.js.map → chunk-KEG4GNGI.js.map} +0 -0
- /package/dist/{chunk-L7WO3MZ4.js.map → chunk-KWP7T3DP.js.map} +0 -0
- /package/dist/{chunk-J47FNDR7.js.map → chunk-MYQWXITD.js.map} +0 -0
- /package/dist/{chunk-YNI4S5WT.js.map → chunk-N53K2EXC.js.map} +0 -0
- /package/dist/{chunk-763GUIOU.js.map → chunk-NBNN5GOB.js.map} +0 -0
- /package/dist/{chunk-OOSWAUYB.js.map → chunk-ODWDQNRE.js.map} +0 -0
- /package/dist/{chunk-J3BT33K7.js.map → chunk-POBPGDWI.js.map} +0 -0
- /package/dist/{chunk-OTAVQCSF.js.map → chunk-PYXS46O7.js.map} +0 -0
- /package/dist/{chunk-XUHI52HK.js.map → chunk-QKAH5B6E.js.map} +0 -0
- /package/dist/{chunk-HG2NKWR2.js.map → chunk-S4LX5EBI.js.map} +0 -0
- /package/dist/{chunk-4A24LIM2.js.map → chunk-S75M5ZRK.js.map} +0 -0
- /package/dist/{chunk-MDDAA2AO.js.map → chunk-UPMD5XND.js.map} +0 -0
- /package/dist/{chunk-M5KEYE5E.js.map → chunk-URB2WSKZ.js.map} +0 -0
package/dist/access-schema.js
CHANGED
package/dist/access-service.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { DaySummaryResult, RecallPlanMode, MemoryFile, MemoryLifecycleEvent, EntityFile, MemoryStatus } from './types.js';
|
|
2
2
|
import { ExplicitCaptureInput } from './explicit-capture.js';
|
|
3
|
-
import { r as readMemoryGovernanceRunArtifact } from './memory-projection-store-
|
|
3
|
+
import { r as readMemoryGovernanceRunArtifact } from './memory-projection-store-DeSXPh1j.js';
|
|
4
4
|
import { LastRecallSnapshot } from './recall-state.js';
|
|
5
|
-
import { O as Orchestrator, I as IntentDebugSnapshot, G as GraphRecallSnapshot } from './orchestrator-
|
|
5
|
+
import { O as Orchestrator, I as IntentDebugSnapshot, G as GraphRecallSnapshot } from './orchestrator-B9kwlCep.js';
|
|
6
6
|
import { TrustZoneStoreStatus, TrustZoneName, TrustZoneRecordKind, TrustZoneSourceClass, TrustZoneProvenanceScore, TrustZonePromotionResult, TrustZoneDemoSeedResult } from './trust-zones.js';
|
|
7
7
|
import 'better-sqlite3';
|
|
8
8
|
import './buffer.js';
|
|
9
9
|
import './storage.js';
|
|
10
|
+
import './page-versioning.js';
|
|
10
11
|
import './port-C1GZFv8h.js';
|
|
11
12
|
import './transcript.js';
|
|
12
13
|
import './session-integrity.js';
|
|
@@ -17,7 +18,9 @@ import './relevance.js';
|
|
|
17
18
|
import './negative.js';
|
|
18
19
|
import './session-observer-state.js';
|
|
19
20
|
import './embedding-fallback.js';
|
|
20
|
-
import './semantic-consolidation.js';
|
|
21
|
+
import './semantic-consolidation-DrvSYRdB.js';
|
|
22
|
+
import './codex-materialize-CQlLTzke.js';
|
|
23
|
+
import './logger.js';
|
|
21
24
|
import 'zod';
|
|
22
25
|
import './policy-runtime.js';
|
|
23
26
|
import './profiling.js';
|
|
@@ -79,6 +82,28 @@ interface EngramAccessDaySummaryRequest {
|
|
|
79
82
|
sessionKey?: string;
|
|
80
83
|
namespace?: string;
|
|
81
84
|
}
|
|
85
|
+
/** Inputs accepted by the `remnic_briefing` MCP tool. */
|
|
86
|
+
interface EngramAccessBriefingRequest {
|
|
87
|
+
since?: string;
|
|
88
|
+
focus?: string;
|
|
89
|
+
namespace?: string;
|
|
90
|
+
format?: "markdown" | "json";
|
|
91
|
+
maxFollowups?: number;
|
|
92
|
+
/** Caller principal for namespace access checks. Transport-bound — never from untrusted payloads. */
|
|
93
|
+
principal?: string;
|
|
94
|
+
}
|
|
95
|
+
/** Response for `remnic_briefing`. */
|
|
96
|
+
interface EngramAccessBriefingResponse {
|
|
97
|
+
format: "markdown" | "json";
|
|
98
|
+
window: {
|
|
99
|
+
from: string;
|
|
100
|
+
to: string;
|
|
101
|
+
};
|
|
102
|
+
namespace: string;
|
|
103
|
+
markdown: string;
|
|
104
|
+
json: Record<string, unknown>;
|
|
105
|
+
followupsUnavailableReason?: string;
|
|
106
|
+
}
|
|
82
107
|
interface EngramAccessMemoryRecord {
|
|
83
108
|
id: string;
|
|
84
109
|
path: string;
|
|
@@ -349,6 +374,7 @@ declare class EngramAccessService {
|
|
|
349
374
|
private readonly idempotency;
|
|
350
375
|
private readonly idempotencyLocks;
|
|
351
376
|
constructor(orchestrator: Orchestrator);
|
|
377
|
+
get briefingEnabled(): boolean;
|
|
352
378
|
private resolveNamespace;
|
|
353
379
|
private normalizeRecallMode;
|
|
354
380
|
private resolveRecallNamespace;
|
|
@@ -362,6 +388,11 @@ declare class EngramAccessService {
|
|
|
362
388
|
private withIdempotencyLock;
|
|
363
389
|
health(namespace?: string): Promise<EngramAccessHealthResponse>;
|
|
364
390
|
daySummary(request: EngramAccessDaySummaryRequest): Promise<DaySummaryResult | null>;
|
|
391
|
+
/**
|
|
392
|
+
* Build a daily context briefing. Gracefully degrades when the OpenAI key
|
|
393
|
+
* or Responses API is unavailable — never throws for LLM-related problems.
|
|
394
|
+
*/
|
|
395
|
+
briefing(request: EngramAccessBriefingRequest): Promise<EngramAccessBriefingResponse>;
|
|
365
396
|
recall(request: EngramAccessRecallRequest): Promise<EngramAccessRecallResponse>;
|
|
366
397
|
recallExplain(request?: EngramAccessRecallExplainRequest): Promise<EngramAccessRecallExplainResponse>;
|
|
367
398
|
memoryStore(request: EngramAccessMemoryStoreRequest): Promise<EngramAccessWriteResponse>;
|
|
@@ -400,6 +431,15 @@ declare class EngramAccessService {
|
|
|
400
431
|
summaryPath: string;
|
|
401
432
|
reportPath: string;
|
|
402
433
|
}>;
|
|
434
|
+
procedureMiningRun(request: {
|
|
435
|
+
namespace?: string;
|
|
436
|
+
authenticatedPrincipal?: string;
|
|
437
|
+
}, principal?: string): Promise<{
|
|
438
|
+
namespace: string;
|
|
439
|
+
clustersProcessed: number;
|
|
440
|
+
proceduresWritten: number;
|
|
441
|
+
skippedReason?: string;
|
|
442
|
+
}>;
|
|
403
443
|
trustZoneStatus(namespace?: string, principal?: string): Promise<EngramAccessTrustZoneStatusResponse>;
|
|
404
444
|
trustZoneBrowse(request: EngramAccessTrustZoneBrowseRequest, principal?: string): Promise<EngramAccessTrustZoneBrowseResponse>;
|
|
405
445
|
trustZonePromote(request: EngramAccessTrustZonePromoteRequest): Promise<EngramAccessTrustZonePromoteResponse>;
|
|
@@ -609,6 +649,27 @@ declare class EngramAccessService {
|
|
|
609
649
|
saved: boolean;
|
|
610
650
|
}>;
|
|
611
651
|
lcmStatus(): Promise<EngramAccessLcmStatusResponse>;
|
|
652
|
+
/**
|
|
653
|
+
* Record citation usage from an observed oai-mem-citation block.
|
|
654
|
+
* For each citation entry, extract the memory ID from the path and
|
|
655
|
+
* increment its access tracking via the orchestrator. Returns the
|
|
656
|
+
* count of submitted IDs and the count of IDs that matched real memories.
|
|
657
|
+
*/
|
|
658
|
+
recordCitationUsage(request: {
|
|
659
|
+
sessionId?: string;
|
|
660
|
+
namespace?: string;
|
|
661
|
+
authenticatedPrincipal?: string;
|
|
662
|
+
entries: Array<{
|
|
663
|
+
path: string;
|
|
664
|
+
lineStart: number;
|
|
665
|
+
lineEnd: number;
|
|
666
|
+
note: string;
|
|
667
|
+
}>;
|
|
668
|
+
rolloutIds: string[];
|
|
669
|
+
}): Promise<{
|
|
670
|
+
submitted: number;
|
|
671
|
+
matched: number;
|
|
672
|
+
}>;
|
|
612
673
|
}
|
|
613
674
|
|
|
614
|
-
export { ENGRAM_ACCESS_WRITE_SCHEMA_VERSION, type EngramAccessDaySummaryRequest, type EngramAccessEntityListResponse, type EngramAccessEntityResponse, type EngramAccessEntitySummary, type EngramAccessHealthResponse, EngramAccessInputError, type EngramAccessLcmSearchRequest, type EngramAccessLcmSearchResponse, type EngramAccessLcmStatusResponse, type EngramAccessMaintenanceResponse, type EngramAccessMemoryBrowseRequest, type EngramAccessMemoryBrowseResponse, type EngramAccessMemoryRecord, type EngramAccessMemoryResponse, type EngramAccessMemoryStoreRequest, type EngramAccessMemorySummary, type EngramAccessObserveRequest, type EngramAccessObserveResponse, type EngramAccessQualityResponse, type EngramAccessRecallExplainRequest, type EngramAccessRecallExplainResponse, type EngramAccessRecallRequest, type EngramAccessRecallResponse, type EngramAccessReviewDispositionRequest, type EngramAccessReviewDispositionResponse, type EngramAccessReviewQueueResponse, EngramAccessService, type EngramAccessSuggestionSubmitRequest, type EngramAccessTimelineResponse, type EngramAccessTrustZoneBrowseRequest, type EngramAccessTrustZoneBrowseResponse, type EngramAccessTrustZoneDemoSeedRequest, type EngramAccessTrustZoneDemoSeedResponse, type EngramAccessTrustZonePromoteRequest, type EngramAccessTrustZonePromoteResponse, type EngramAccessTrustZoneRecordSummary, type EngramAccessTrustZoneStatusResponse, type EngramAccessWriteEnvelope, type EngramAccessWriteResponse };
|
|
675
|
+
export { ENGRAM_ACCESS_WRITE_SCHEMA_VERSION, type EngramAccessBriefingRequest, type EngramAccessBriefingResponse, type EngramAccessDaySummaryRequest, type EngramAccessEntityListResponse, type EngramAccessEntityResponse, type EngramAccessEntitySummary, type EngramAccessHealthResponse, EngramAccessInputError, type EngramAccessLcmSearchRequest, type EngramAccessLcmSearchResponse, type EngramAccessLcmStatusResponse, type EngramAccessMaintenanceResponse, type EngramAccessMemoryBrowseRequest, type EngramAccessMemoryBrowseResponse, type EngramAccessMemoryRecord, type EngramAccessMemoryResponse, type EngramAccessMemoryStoreRequest, type EngramAccessMemorySummary, type EngramAccessObserveRequest, type EngramAccessObserveResponse, type EngramAccessQualityResponse, type EngramAccessRecallExplainRequest, type EngramAccessRecallExplainResponse, type EngramAccessRecallRequest, type EngramAccessRecallResponse, type EngramAccessReviewDispositionRequest, type EngramAccessReviewDispositionResponse, type EngramAccessReviewQueueResponse, EngramAccessService, type EngramAccessSuggestionSubmitRequest, type EngramAccessTimelineResponse, type EngramAccessTrustZoneBrowseRequest, type EngramAccessTrustZoneBrowseResponse, type EngramAccessTrustZoneDemoSeedRequest, type EngramAccessTrustZoneDemoSeedResponse, type EngramAccessTrustZonePromoteRequest, type EngramAccessTrustZonePromoteResponse, type EngramAccessTrustZoneRecordSummary, type EngramAccessTrustZoneStatusResponse, type EngramAccessWriteEnvelope, type EngramAccessWriteResponse };
|
package/dist/access-service.js
CHANGED
|
@@ -2,28 +2,34 @@ import {
|
|
|
2
2
|
ENGRAM_ACCESS_WRITE_SCHEMA_VERSION,
|
|
3
3
|
EngramAccessInputError,
|
|
4
4
|
EngramAccessService
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-N5AKDXAI.js";
|
|
5
|
+
} from "./chunk-V7XCAHIB.js";
|
|
7
6
|
import "./chunk-EQINRHYR.js";
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-POBPGDWI.js";
|
|
8
|
+
import "./chunk-QDYXG4CS.js";
|
|
9
|
+
import "./chunk-QNJMBKFK.js";
|
|
9
10
|
import "./chunk-EEQLFRUM.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-QDW3E4RD.js";
|
|
12
|
+
import "./chunk-4NRAJUDS.js";
|
|
13
|
+
import "./chunk-DT5TVLJE.js";
|
|
14
|
+
import "./chunk-TBBDFYXW.js";
|
|
15
|
+
import "./chunk-DGXUHMOV.js";
|
|
16
|
+
import "./chunk-LPSF4OQH.js";
|
|
17
|
+
import "./chunk-XKECPATV.js";
|
|
18
|
+
import "./chunk-ECKDIK5F.js";
|
|
19
|
+
import "./chunk-POMSFKTB.js";
|
|
20
|
+
import "./chunk-U2IQTSBY.js";
|
|
21
|
+
import "./chunk-4KAN3GZ3.js";
|
|
22
|
+
import "./chunk-6ZH4TU6I.js";
|
|
23
|
+
import "./chunk-6PFRXT4K.js";
|
|
13
24
|
import "./chunk-TP4FZJIZ.js";
|
|
14
25
|
import "./chunk-SCU65EZI.js";
|
|
15
26
|
import "./chunk-BOUYNNYD.js";
|
|
16
|
-
import "./chunk-DM2T26WE.js";
|
|
17
27
|
import "./chunk-QSVPYQPG.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-HLXVTBF3.js";
|
|
28
|
+
import "./chunk-DM2T26WE.js";
|
|
20
29
|
import "./chunk-M62O4P4T.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-LPSF4OQH.js";
|
|
25
|
-
import "./chunk-XKECPATV.js";
|
|
26
|
-
import "./chunk-QCCCQT3O.js";
|
|
30
|
+
import "./chunk-4DJQYKMN.js";
|
|
31
|
+
import "./chunk-2ODBA7MQ.js";
|
|
32
|
+
import "./chunk-N5AKDXAI.js";
|
|
27
33
|
export {
|
|
28
34
|
ENGRAM_ACCESS_WRITE_SCHEMA_VERSION,
|
|
29
35
|
EngramAccessInputError,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { PluginConfig, MemoryFile } from './types.js';
|
|
2
|
+
|
|
3
|
+
interface ActiveMemoryMetadata {
|
|
4
|
+
type?: "fact" | "preference";
|
|
5
|
+
topic?: string;
|
|
6
|
+
updatedAt?: string;
|
|
7
|
+
sourceUri?: string;
|
|
8
|
+
}
|
|
9
|
+
interface ActiveMemorySearchResult {
|
|
10
|
+
id: string;
|
|
11
|
+
score: number;
|
|
12
|
+
text: string;
|
|
13
|
+
metadata?: ActiveMemoryMetadata;
|
|
14
|
+
}
|
|
15
|
+
interface ActiveMemorySearchOutput {
|
|
16
|
+
results: ActiveMemorySearchResult[];
|
|
17
|
+
truncated: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface ActiveMemoryGetOutput {
|
|
20
|
+
id?: string;
|
|
21
|
+
text?: string;
|
|
22
|
+
metadata?: ActiveMemoryMetadata;
|
|
23
|
+
error?: "not_found";
|
|
24
|
+
}
|
|
25
|
+
interface ActiveMemoryRecallParams {
|
|
26
|
+
query: string;
|
|
27
|
+
limit?: number;
|
|
28
|
+
sessionKey: string;
|
|
29
|
+
filters?: Record<string, unknown>;
|
|
30
|
+
snippetMaxChars?: number;
|
|
31
|
+
}
|
|
32
|
+
type ActiveMemorySearchCandidate = {
|
|
33
|
+
id?: string;
|
|
34
|
+
score?: number;
|
|
35
|
+
snippet?: string;
|
|
36
|
+
text?: string;
|
|
37
|
+
path?: string;
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
declare function recallForActiveMemory(orchestrator: {
|
|
41
|
+
config?: PluginConfig;
|
|
42
|
+
resolvePrincipal?: (sessionKey?: string) => string;
|
|
43
|
+
resolveSelfNamespace?: (sessionKey?: string) => string;
|
|
44
|
+
searchAcrossNamespaces: (params: {
|
|
45
|
+
query: string;
|
|
46
|
+
maxResults?: number;
|
|
47
|
+
namespaces?: string[];
|
|
48
|
+
mode?: string;
|
|
49
|
+
}) => Promise<ActiveMemorySearchCandidate[]>;
|
|
50
|
+
}, params: ActiveMemoryRecallParams): Promise<ActiveMemorySearchOutput>;
|
|
51
|
+
declare function getMemoryForActiveMemory(orchestrator: {
|
|
52
|
+
config?: PluginConfig;
|
|
53
|
+
resolvePrincipal?: (sessionKey?: string) => string;
|
|
54
|
+
resolveSelfNamespace?: (sessionKey?: string) => string;
|
|
55
|
+
getStorageForNamespace?: (namespace: string) => Promise<{
|
|
56
|
+
getMemoryById?: (id: string) => Promise<MemoryFile | null>;
|
|
57
|
+
}>;
|
|
58
|
+
storage?: {
|
|
59
|
+
getMemoryById?: (id: string) => Promise<MemoryFile | null>;
|
|
60
|
+
};
|
|
61
|
+
}, id: string, options?: {
|
|
62
|
+
namespace?: string;
|
|
63
|
+
sessionKey?: string;
|
|
64
|
+
}): Promise<ActiveMemoryGetOutput>;
|
|
65
|
+
|
|
66
|
+
export { type ActiveMemoryGetOutput, type ActiveMemoryMetadata, type ActiveMemoryRecallParams, type ActiveMemorySearchOutput, type ActiveMemorySearchResult, getMemoryForActiveMemory, recallForActiveMemory };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getMemoryForActiveMemory,
|
|
3
|
+
recallForActiveMemory
|
|
4
|
+
} from "./chunk-G4SK7DSQ.js";
|
|
5
|
+
import "./chunk-6MKAMLQL.js";
|
|
6
|
+
import "./chunk-N5AKDXAI.js";
|
|
7
|
+
export {
|
|
8
|
+
getMemoryForActiveMemory,
|
|
9
|
+
recallForActiveMemory
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=active-memory-bridge.js.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ActiveRecallChatType, ActiveRecallQueryMode, ActiveRecallPromptStyle, ActiveRecallThinking, ActiveRecallModelFallbackPolicy } from './types.js';
|
|
2
|
+
|
|
3
|
+
interface ActiveRecallTurn {
|
|
4
|
+
role: "user" | "assistant";
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
interface ActiveRecallInput {
|
|
8
|
+
sessionKey: string;
|
|
9
|
+
agentId: string;
|
|
10
|
+
chatType: ActiveRecallChatType;
|
|
11
|
+
recentTurns: ActiveRecallTurn[];
|
|
12
|
+
currentMessage: string;
|
|
13
|
+
}
|
|
14
|
+
interface ActiveRecallConfig {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
agents: string[] | null;
|
|
17
|
+
allowedChatTypes: ActiveRecallChatType[];
|
|
18
|
+
queryMode: ActiveRecallQueryMode;
|
|
19
|
+
promptStyle: ActiveRecallPromptStyle;
|
|
20
|
+
promptOverride: string | null;
|
|
21
|
+
promptAppend: string | null;
|
|
22
|
+
maxSummaryChars: number;
|
|
23
|
+
recentUserTurns: number;
|
|
24
|
+
recentAssistantTurns: number;
|
|
25
|
+
recentUserChars: number;
|
|
26
|
+
recentAssistantChars: number;
|
|
27
|
+
thinking: ActiveRecallThinking;
|
|
28
|
+
timeoutMs: number;
|
|
29
|
+
cacheTtlMs: number;
|
|
30
|
+
persistTranscripts: boolean;
|
|
31
|
+
transcriptDir: string;
|
|
32
|
+
entityGraphDepth: number;
|
|
33
|
+
includeCausalTrajectories: boolean;
|
|
34
|
+
includeDaySummary: boolean;
|
|
35
|
+
attachRecallExplain: boolean;
|
|
36
|
+
modelOverride: string | null;
|
|
37
|
+
modelFallbackPolicy: ActiveRecallModelFallbackPolicy;
|
|
38
|
+
}
|
|
39
|
+
interface ActiveRecallResult {
|
|
40
|
+
summary: string | null;
|
|
41
|
+
citations: Array<{
|
|
42
|
+
memoryId: string;
|
|
43
|
+
relevance: number;
|
|
44
|
+
}>;
|
|
45
|
+
latencyMs: number;
|
|
46
|
+
cacheHit: boolean;
|
|
47
|
+
modelUsed: string;
|
|
48
|
+
transcriptPath: string | null;
|
|
49
|
+
}
|
|
50
|
+
interface ActiveRecallDependencies {
|
|
51
|
+
recall(query: string, sessionKey: string): Promise<string | null>;
|
|
52
|
+
getLastRecallSnapshot?(sessionKey: string): {
|
|
53
|
+
memoryIds?: string[];
|
|
54
|
+
} | null;
|
|
55
|
+
walkEntityGraph?(params: {
|
|
56
|
+
sessionKey: string;
|
|
57
|
+
query: string;
|
|
58
|
+
depth: number;
|
|
59
|
+
}): Promise<string[]>;
|
|
60
|
+
loadCausalTrajectories?(params: {
|
|
61
|
+
sessionKey: string;
|
|
62
|
+
query: string;
|
|
63
|
+
}): Promise<string[]>;
|
|
64
|
+
loadDaySummary?(sessionKey: string): Promise<string | null>;
|
|
65
|
+
explainLastRecall?(sessionKey: string): Promise<string | null>;
|
|
66
|
+
generateSummary?(params: {
|
|
67
|
+
prompt: string;
|
|
68
|
+
sessionKey: string;
|
|
69
|
+
agentId: string;
|
|
70
|
+
model: string;
|
|
71
|
+
timeoutMs: number;
|
|
72
|
+
thinking: ActiveRecallThinking;
|
|
73
|
+
fallbackPolicy: ActiveRecallModelFallbackPolicy;
|
|
74
|
+
}): Promise<{
|
|
75
|
+
text: string | null;
|
|
76
|
+
modelUsed?: string;
|
|
77
|
+
cacheHit?: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
now?: () => number;
|
|
80
|
+
}
|
|
81
|
+
declare function buildActiveRecallQueryBundle(input: ActiveRecallInput, config: ActiveRecallConfig): string;
|
|
82
|
+
declare function normalizeActiveRecallSummary(value: string | null, maxChars: number): string | null;
|
|
83
|
+
declare function buildActiveRecallPrompt(params: {
|
|
84
|
+
config: ActiveRecallConfig;
|
|
85
|
+
queryBundle: string;
|
|
86
|
+
recallContext: string | null;
|
|
87
|
+
graphContext: string[];
|
|
88
|
+
causalContext: string[];
|
|
89
|
+
daySummary: string | null;
|
|
90
|
+
recallExplain: string | null;
|
|
91
|
+
}): string;
|
|
92
|
+
declare function createActiveRecallEngine(deps: ActiveRecallDependencies, config: ActiveRecallConfig): {
|
|
93
|
+
run(input: ActiveRecallInput): Promise<ActiveRecallResult>;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { type ActiveRecallConfig, type ActiveRecallDependencies, type ActiveRecallInput, type ActiveRecallResult, type ActiveRecallTurn, buildActiveRecallPrompt, buildActiveRecallQueryBundle, createActiveRecallEngine, normalizeActiveRecallSummary };
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import {
|
|
2
|
+
collapseWhitespace,
|
|
3
|
+
truncateCodePointSafe
|
|
4
|
+
} from "./chunk-6MKAMLQL.js";
|
|
5
|
+
|
|
6
|
+
// src/active-recall.ts
|
|
7
|
+
import { appendFile, mkdir } from "fs/promises";
|
|
8
|
+
import path from "path";
|
|
9
|
+
var ACTIVE_RECALL_CACHE_MAX_ENTRIES = 256;
|
|
10
|
+
var NONE_SET = /* @__PURE__ */ new Set([
|
|
11
|
+
"",
|
|
12
|
+
"none",
|
|
13
|
+
"no_reply",
|
|
14
|
+
"nothing useful",
|
|
15
|
+
"no relevant memory",
|
|
16
|
+
"timeout",
|
|
17
|
+
"[]",
|
|
18
|
+
"{}",
|
|
19
|
+
"null",
|
|
20
|
+
"n/a"
|
|
21
|
+
]);
|
|
22
|
+
var STYLE_INSTRUCTIONS = {
|
|
23
|
+
balanced: "Summarize the most relevant memory context in a compact, neutral way.",
|
|
24
|
+
strict: "Only include memory that is directly supported by the retrieved context.",
|
|
25
|
+
contextual: "Prefer concise context that helps the next reply stay grounded in recent work.",
|
|
26
|
+
"recall-heavy": "Bias toward richer recall coverage when multiple retrieved items reinforce each other.",
|
|
27
|
+
"precision-heavy": "Bias toward precision. Omit anything uncertain or weakly supported.",
|
|
28
|
+
"preference-only": "Only surface user preference or operating-style memory when present."
|
|
29
|
+
};
|
|
30
|
+
function cloneRecallResult(value) {
|
|
31
|
+
return {
|
|
32
|
+
...value,
|
|
33
|
+
citations: [...value.citations]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function buildCacheKey(input, config, queryBundle) {
|
|
37
|
+
return JSON.stringify({
|
|
38
|
+
sessionKey: input.sessionKey,
|
|
39
|
+
agentId: input.agentId,
|
|
40
|
+
queryMode: config.queryMode,
|
|
41
|
+
promptStyle: config.promptStyle,
|
|
42
|
+
promptOverride: config.promptOverride,
|
|
43
|
+
promptAppend: config.promptAppend,
|
|
44
|
+
maxSummaryChars: config.maxSummaryChars,
|
|
45
|
+
entityGraphDepth: config.entityGraphDepth,
|
|
46
|
+
includeCausalTrajectories: config.includeCausalTrajectories,
|
|
47
|
+
includeDaySummary: config.includeDaySummary,
|
|
48
|
+
attachRecallExplain: config.attachRecallExplain,
|
|
49
|
+
modelOverride: config.modelOverride,
|
|
50
|
+
modelFallbackPolicy: config.modelFallbackPolicy,
|
|
51
|
+
thinking: config.thinking,
|
|
52
|
+
queryBundle
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function pruneExpiredCache(cache, currentTime) {
|
|
56
|
+
for (const [key, entry] of cache.entries()) {
|
|
57
|
+
if (entry.expiresAt <= currentTime) {
|
|
58
|
+
cache.delete(key);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function enforceCacheLimit(cache) {
|
|
63
|
+
while (cache.size > ACTIVE_RECALL_CACHE_MAX_ENTRIES) {
|
|
64
|
+
const oldestKey = cache.keys().next().value;
|
|
65
|
+
if (typeof oldestKey !== "string") {
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
cache.delete(oldestKey);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function cropTurns(turns, role, maxTurns, maxChars) {
|
|
72
|
+
if (maxTurns <= 0) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
const selected = [];
|
|
76
|
+
for (let index = turns.length - 1; index >= 0 && selected.length < maxTurns; index -= 1) {
|
|
77
|
+
const turn = turns[index];
|
|
78
|
+
if (turn?.role === role) {
|
|
79
|
+
selected.push({
|
|
80
|
+
index,
|
|
81
|
+
role: turn.role,
|
|
82
|
+
content: collapseWhitespace(truncateCodePointSafe(turn.content, maxChars))
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return selected.reverse();
|
|
87
|
+
}
|
|
88
|
+
function mergeChronologicalTurns(userTurns, assistantTurns) {
|
|
89
|
+
return [...userTurns, ...assistantTurns].sort((left, right) => left.index - right.index).filter((value) => value.content.length > 0);
|
|
90
|
+
}
|
|
91
|
+
function buildActiveRecallQueryBundle(input, config) {
|
|
92
|
+
if (config.queryMode === "message") {
|
|
93
|
+
return collapseWhitespace(input.currentMessage);
|
|
94
|
+
}
|
|
95
|
+
const userTurns = cropTurns(
|
|
96
|
+
input.recentTurns,
|
|
97
|
+
"user",
|
|
98
|
+
config.recentUserTurns,
|
|
99
|
+
config.recentUserChars
|
|
100
|
+
);
|
|
101
|
+
const assistantTurns = cropTurns(
|
|
102
|
+
input.recentTurns,
|
|
103
|
+
"assistant",
|
|
104
|
+
config.recentAssistantTurns,
|
|
105
|
+
config.recentAssistantChars
|
|
106
|
+
);
|
|
107
|
+
const mergedTurns = mergeChronologicalTurns(userTurns, assistantTurns);
|
|
108
|
+
const parts = [
|
|
109
|
+
...mergedTurns.map((turn) => `${turn.role}: ${turn.content}`)
|
|
110
|
+
];
|
|
111
|
+
if (config.queryMode === "full") {
|
|
112
|
+
return [...parts, `current: ${collapseWhitespace(input.currentMessage)}`].filter((value) => value.trim().length > 0).join("\n");
|
|
113
|
+
}
|
|
114
|
+
return [`current: ${collapseWhitespace(input.currentMessage)}`, ...parts].filter((value) => value.trim().length > 0).join("\n");
|
|
115
|
+
}
|
|
116
|
+
function normalizeActiveRecallSummary(value, maxChars) {
|
|
117
|
+
if (value == null) return null;
|
|
118
|
+
const compact = collapseWhitespace(value);
|
|
119
|
+
if (NONE_SET.has(compact.toLowerCase())) return null;
|
|
120
|
+
return truncateCodePointSafe(compact, maxChars);
|
|
121
|
+
}
|
|
122
|
+
function sanitizeTranscriptPathSegment(value) {
|
|
123
|
+
const normalized = collapseWhitespace(value);
|
|
124
|
+
return encodeURIComponent(normalized.length > 0 ? normalized : "unknown").replaceAll(
|
|
125
|
+
".",
|
|
126
|
+
"%2E"
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
function buildActiveRecallPrompt(params) {
|
|
130
|
+
const sections = [
|
|
131
|
+
params.config.promptOverride?.trim() || STYLE_INSTRUCTIONS[params.config.promptStyle],
|
|
132
|
+
`Query bundle:
|
|
133
|
+
${params.queryBundle}`,
|
|
134
|
+
params.recallContext ? `Retrieved memory:
|
|
135
|
+
${params.recallContext}` : null,
|
|
136
|
+
params.graphContext.length > 0 ? `Entity graph:
|
|
137
|
+
${params.graphContext.join("\n")}` : null,
|
|
138
|
+
params.causalContext.length > 0 ? `Causal trajectories:
|
|
139
|
+
${params.causalContext.join("\n")}` : null,
|
|
140
|
+
params.daySummary ? `Day summary:
|
|
141
|
+
${params.daySummary}` : null,
|
|
142
|
+
params.recallExplain ? `Recall explain:
|
|
143
|
+
${params.recallExplain}` : null,
|
|
144
|
+
params.config.promptAppend?.trim() || null,
|
|
145
|
+
"Return either NONE or a compact summary grounded only in the supplied context."
|
|
146
|
+
];
|
|
147
|
+
return sections.filter((value) => !!value && value.trim().length > 0).join("\n\n");
|
|
148
|
+
}
|
|
149
|
+
async function appendActiveRecallTranscript(transcriptRoot, input, config, result, queryBundle) {
|
|
150
|
+
const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
151
|
+
const filePath = path.join(
|
|
152
|
+
transcriptRoot,
|
|
153
|
+
"agents",
|
|
154
|
+
sanitizeTranscriptPathSegment(input.agentId),
|
|
155
|
+
date,
|
|
156
|
+
`${sanitizeTranscriptPathSegment(input.sessionKey)}.jsonl`
|
|
157
|
+
);
|
|
158
|
+
await mkdir(path.dirname(filePath), { recursive: true });
|
|
159
|
+
await appendFile(
|
|
160
|
+
filePath,
|
|
161
|
+
`${JSON.stringify({
|
|
162
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
163
|
+
sessionKey: input.sessionKey,
|
|
164
|
+
agentId: input.agentId,
|
|
165
|
+
queryMode: config.queryMode,
|
|
166
|
+
promptStyle: config.promptStyle,
|
|
167
|
+
queryBundle,
|
|
168
|
+
summary: result.summary,
|
|
169
|
+
citations: result.citations,
|
|
170
|
+
latencyMs: result.latencyMs,
|
|
171
|
+
cacheHit: result.cacheHit,
|
|
172
|
+
modelUsed: result.modelUsed
|
|
173
|
+
})}
|
|
174
|
+
`,
|
|
175
|
+
"utf8"
|
|
176
|
+
);
|
|
177
|
+
return filePath;
|
|
178
|
+
}
|
|
179
|
+
function createActiveRecallEngine(deps, config) {
|
|
180
|
+
const cache = /* @__PURE__ */ new Map();
|
|
181
|
+
const now = deps.now ?? (() => Date.now());
|
|
182
|
+
return {
|
|
183
|
+
async run(input) {
|
|
184
|
+
if (!config.enabled) {
|
|
185
|
+
return {
|
|
186
|
+
summary: null,
|
|
187
|
+
citations: [],
|
|
188
|
+
latencyMs: 0,
|
|
189
|
+
cacheHit: false,
|
|
190
|
+
modelUsed: config.modelOverride ?? "disabled",
|
|
191
|
+
transcriptPath: null
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (config.agents && !config.agents.includes(input.agentId)) {
|
|
195
|
+
return {
|
|
196
|
+
summary: null,
|
|
197
|
+
citations: [],
|
|
198
|
+
latencyMs: 0,
|
|
199
|
+
cacheHit: false,
|
|
200
|
+
modelUsed: config.modelOverride ?? "filtered",
|
|
201
|
+
transcriptPath: null
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
if (!config.allowedChatTypes.includes(input.chatType)) {
|
|
205
|
+
return {
|
|
206
|
+
summary: null,
|
|
207
|
+
citations: [],
|
|
208
|
+
latencyMs: 0,
|
|
209
|
+
cacheHit: false,
|
|
210
|
+
modelUsed: config.modelOverride ?? "filtered",
|
|
211
|
+
transcriptPath: null
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const queryBundle = buildActiveRecallQueryBundle(input, config);
|
|
215
|
+
const cacheKey = buildCacheKey(input, config, queryBundle);
|
|
216
|
+
const currentTime = now();
|
|
217
|
+
const cacheEnabled = config.cacheTtlMs > 0;
|
|
218
|
+
if (cacheEnabled) {
|
|
219
|
+
pruneExpiredCache(cache, currentTime);
|
|
220
|
+
}
|
|
221
|
+
const cached = cache.get(cacheKey);
|
|
222
|
+
if (cacheEnabled && cached) {
|
|
223
|
+
return {
|
|
224
|
+
...cloneRecallResult(cached.value),
|
|
225
|
+
latencyMs: Math.max(0, now() - currentTime),
|
|
226
|
+
cacheHit: true
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
const start = currentTime;
|
|
230
|
+
const recallContext = await deps.recall(queryBundle, input.sessionKey);
|
|
231
|
+
const graphContext = config.entityGraphDepth > 0 && deps.walkEntityGraph ? await deps.walkEntityGraph({
|
|
232
|
+
sessionKey: input.sessionKey,
|
|
233
|
+
query: queryBundle,
|
|
234
|
+
depth: config.entityGraphDepth
|
|
235
|
+
}) : [];
|
|
236
|
+
const causalContext = config.includeCausalTrajectories && deps.loadCausalTrajectories ? await deps.loadCausalTrajectories({
|
|
237
|
+
sessionKey: input.sessionKey,
|
|
238
|
+
query: queryBundle
|
|
239
|
+
}) : [];
|
|
240
|
+
const daySummary = config.includeDaySummary && deps.loadDaySummary ? await deps.loadDaySummary(input.sessionKey) : null;
|
|
241
|
+
const recallExplain = config.attachRecallExplain && deps.explainLastRecall ? await deps.explainLastRecall(input.sessionKey) : null;
|
|
242
|
+
const prompt = buildActiveRecallPrompt({
|
|
243
|
+
config,
|
|
244
|
+
queryBundle,
|
|
245
|
+
recallContext,
|
|
246
|
+
graphContext,
|
|
247
|
+
causalContext,
|
|
248
|
+
daySummary,
|
|
249
|
+
recallExplain
|
|
250
|
+
});
|
|
251
|
+
const generated = deps.generateSummary ? await deps.generateSummary({
|
|
252
|
+
prompt,
|
|
253
|
+
sessionKey: input.sessionKey,
|
|
254
|
+
agentId: input.agentId,
|
|
255
|
+
model: config.modelOverride ?? "gpt-5.2",
|
|
256
|
+
timeoutMs: config.timeoutMs,
|
|
257
|
+
thinking: config.thinking,
|
|
258
|
+
fallbackPolicy: config.modelFallbackPolicy
|
|
259
|
+
}) : {
|
|
260
|
+
text: recallContext,
|
|
261
|
+
modelUsed: config.modelOverride ?? "gpt-5.2",
|
|
262
|
+
cacheHit: false
|
|
263
|
+
};
|
|
264
|
+
const summary = normalizeActiveRecallSummary(
|
|
265
|
+
generated.text,
|
|
266
|
+
config.maxSummaryChars
|
|
267
|
+
);
|
|
268
|
+
const snapshot = deps.getLastRecallSnapshot?.(input.sessionKey);
|
|
269
|
+
const citations = (snapshot?.memoryIds ?? []).map((memoryId, index) => ({
|
|
270
|
+
memoryId,
|
|
271
|
+
relevance: Number((1 / (index + 1)).toFixed(3))
|
|
272
|
+
}));
|
|
273
|
+
const result = {
|
|
274
|
+
summary,
|
|
275
|
+
citations,
|
|
276
|
+
latencyMs: Math.max(0, now() - start),
|
|
277
|
+
cacheHit: generated.cacheHit === true,
|
|
278
|
+
modelUsed: generated.modelUsed ?? config.modelOverride ?? "gpt-5.2",
|
|
279
|
+
transcriptPath: null
|
|
280
|
+
};
|
|
281
|
+
if (config.persistTranscripts) {
|
|
282
|
+
result.transcriptPath = await appendActiveRecallTranscript(
|
|
283
|
+
config.transcriptDir,
|
|
284
|
+
input,
|
|
285
|
+
config,
|
|
286
|
+
result,
|
|
287
|
+
queryBundle
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
if (cacheEnabled) {
|
|
291
|
+
const completedAt = now();
|
|
292
|
+
cache.set(cacheKey, {
|
|
293
|
+
expiresAt: completedAt + config.cacheTtlMs,
|
|
294
|
+
value: cloneRecallResult(result)
|
|
295
|
+
});
|
|
296
|
+
enforceCacheLimit(cache);
|
|
297
|
+
}
|
|
298
|
+
return result;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
export {
|
|
303
|
+
buildActiveRecallPrompt,
|
|
304
|
+
buildActiveRecallQueryBundle,
|
|
305
|
+
createActiveRecallEngine,
|
|
306
|
+
normalizeActiveRecallSummary
|
|
307
|
+
};
|
|
308
|
+
//# sourceMappingURL=active-recall.js.map
|