@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/active-recall.ts"],"sourcesContent":["import { appendFile, mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { collapseWhitespace, truncateCodePointSafe } from \"./whitespace.js\";\nimport type {\n ActiveRecallChatType,\n ActiveRecallModelFallbackPolicy,\n ActiveRecallPromptStyle,\n ActiveRecallQueryMode,\n ActiveRecallThinking,\n} from \"./types.js\";\n\nexport interface ActiveRecallTurn {\n role: \"user\" | \"assistant\";\n content: string;\n}\n\nexport interface ActiveRecallInput {\n sessionKey: string;\n agentId: string;\n chatType: ActiveRecallChatType;\n recentTurns: ActiveRecallTurn[];\n currentMessage: string;\n}\n\nexport interface ActiveRecallConfig {\n enabled: boolean;\n agents: string[] | null;\n allowedChatTypes: ActiveRecallChatType[];\n queryMode: ActiveRecallQueryMode;\n promptStyle: ActiveRecallPromptStyle;\n promptOverride: string | null;\n promptAppend: string | null;\n maxSummaryChars: number;\n recentUserTurns: number;\n recentAssistantTurns: number;\n recentUserChars: number;\n recentAssistantChars: number;\n thinking: ActiveRecallThinking;\n timeoutMs: number;\n cacheTtlMs: number;\n persistTranscripts: boolean;\n transcriptDir: string;\n entityGraphDepth: number;\n includeCausalTrajectories: boolean;\n includeDaySummary: boolean;\n attachRecallExplain: boolean;\n modelOverride: string | null;\n modelFallbackPolicy: ActiveRecallModelFallbackPolicy;\n}\n\nexport interface ActiveRecallResult {\n summary: string | null;\n citations: Array<{ memoryId: string; relevance: number }>;\n latencyMs: number;\n cacheHit: boolean;\n modelUsed: string;\n transcriptPath: string | null;\n}\n\nexport interface ActiveRecallDependencies {\n recall(query: string, sessionKey: string): Promise<string | null>;\n getLastRecallSnapshot?(sessionKey: string): { memoryIds?: string[] } | null;\n walkEntityGraph?(params: {\n sessionKey: string;\n query: string;\n depth: number;\n }): Promise<string[]>;\n loadCausalTrajectories?(params: {\n sessionKey: string;\n query: string;\n }): Promise<string[]>;\n loadDaySummary?(sessionKey: string): Promise<string | null>;\n explainLastRecall?(sessionKey: string): Promise<string | null>;\n generateSummary?(params: {\n prompt: string;\n sessionKey: string;\n agentId: string;\n model: string;\n timeoutMs: number;\n thinking: ActiveRecallThinking;\n fallbackPolicy: ActiveRecallModelFallbackPolicy;\n }): Promise<{ text: string | null; modelUsed?: string; cacheHit?: boolean }>;\n now?: () => number;\n}\n\ninterface CachedRecallResult {\n expiresAt: number;\n value: ActiveRecallResult;\n}\n\ninterface ActiveRecallTurnWithIndex {\n index: number;\n role: ActiveRecallTurn[\"role\"];\n content: string;\n}\n\nconst ACTIVE_RECALL_CACHE_MAX_ENTRIES = 256;\n\nconst NONE_SET = new Set([\n \"\",\n \"none\",\n \"no_reply\",\n \"nothing useful\",\n \"no relevant memory\",\n \"timeout\",\n \"[]\",\n \"{}\",\n \"null\",\n \"n/a\",\n]);\n\nconst STYLE_INSTRUCTIONS: Record<ActiveRecallPromptStyle, string> = {\n balanced: \"Summarize the most relevant memory context in a compact, neutral way.\",\n strict: \"Only include memory that is directly supported by the retrieved context.\",\n contextual: \"Prefer concise context that helps the next reply stay grounded in recent work.\",\n \"recall-heavy\": \"Bias toward richer recall coverage when multiple retrieved items reinforce each other.\",\n \"precision-heavy\": \"Bias toward precision. Omit anything uncertain or weakly supported.\",\n \"preference-only\": \"Only surface user preference or operating-style memory when present.\",\n};\n\nfunction cloneRecallResult(value: ActiveRecallResult): ActiveRecallResult {\n return {\n ...value,\n citations: [...value.citations],\n };\n}\n\nfunction buildCacheKey(input: ActiveRecallInput, config: ActiveRecallConfig, queryBundle: string): string {\n return JSON.stringify({\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n promptOverride: config.promptOverride,\n promptAppend: config.promptAppend,\n maxSummaryChars: config.maxSummaryChars,\n entityGraphDepth: config.entityGraphDepth,\n includeCausalTrajectories: config.includeCausalTrajectories,\n includeDaySummary: config.includeDaySummary,\n attachRecallExplain: config.attachRecallExplain,\n modelOverride: config.modelOverride,\n modelFallbackPolicy: config.modelFallbackPolicy,\n thinking: config.thinking,\n queryBundle,\n });\n}\n\nfunction pruneExpiredCache(\n cache: Map<string, CachedRecallResult>,\n currentTime: number,\n): void {\n for (const [key, entry] of cache.entries()) {\n if (entry.expiresAt <= currentTime) {\n cache.delete(key);\n }\n }\n}\n\nfunction enforceCacheLimit(cache: Map<string, CachedRecallResult>): void {\n while (cache.size > ACTIVE_RECALL_CACHE_MAX_ENTRIES) {\n const oldestKey = cache.keys().next().value;\n if (typeof oldestKey !== \"string\") {\n break;\n }\n cache.delete(oldestKey);\n }\n}\n\nfunction cropTurns(\n turns: ActiveRecallTurn[],\n role: \"user\" | \"assistant\",\n maxTurns: number,\n maxChars: number,\n): ActiveRecallTurnWithIndex[] {\n if (maxTurns <= 0) {\n return [];\n }\n\n const selected: ActiveRecallTurnWithIndex[] = [];\n for (let index = turns.length - 1; index >= 0 && selected.length < maxTurns; index -= 1) {\n const turn = turns[index];\n if (turn?.role === role) {\n selected.push({\n index,\n role: turn.role,\n content: collapseWhitespace(truncateCodePointSafe(turn.content, maxChars)),\n });\n }\n }\n\n return selected.reverse();\n}\n\nfunction mergeChronologicalTurns(\n userTurns: ActiveRecallTurnWithIndex[],\n assistantTurns: ActiveRecallTurnWithIndex[],\n): ActiveRecallTurnWithIndex[] {\n return [...userTurns, ...assistantTurns]\n .sort((left, right) => left.index - right.index)\n .filter((value) => value.content.length > 0);\n}\n\nexport function buildActiveRecallQueryBundle(\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n): string {\n if (config.queryMode === \"message\") {\n return collapseWhitespace(input.currentMessage);\n }\n\n const userTurns = cropTurns(\n input.recentTurns,\n \"user\",\n config.recentUserTurns,\n config.recentUserChars,\n );\n const assistantTurns = cropTurns(\n input.recentTurns,\n \"assistant\",\n config.recentAssistantTurns,\n config.recentAssistantChars,\n );\n const mergedTurns = mergeChronologicalTurns(userTurns, assistantTurns);\n\n const parts = [\n ...mergedTurns.map((turn) => `${turn.role}: ${turn.content}`),\n ];\n\n if (config.queryMode === \"full\") {\n return [...parts, `current: ${collapseWhitespace(input.currentMessage)}`]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n }\n\n return [`current: ${collapseWhitespace(input.currentMessage)}`, ...parts]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n}\n\nexport function normalizeActiveRecallSummary(value: string | null, maxChars: number): string | null {\n if (value == null) return null;\n const compact = collapseWhitespace(value);\n if (NONE_SET.has(compact.toLowerCase())) return null;\n return truncateCodePointSafe(compact, maxChars);\n}\n\nfunction sanitizeTranscriptPathSegment(value: string): string {\n const normalized = collapseWhitespace(value);\n return encodeURIComponent(normalized.length > 0 ? normalized : \"unknown\").replaceAll(\n \".\",\n \"%2E\",\n );\n}\n\nexport function buildActiveRecallPrompt(params: {\n config: ActiveRecallConfig;\n queryBundle: string;\n recallContext: string | null;\n graphContext: string[];\n causalContext: string[];\n daySummary: string | null;\n recallExplain: string | null;\n}): string {\n const sections = [\n params.config.promptOverride?.trim() || STYLE_INSTRUCTIONS[params.config.promptStyle],\n `Query bundle:\\n${params.queryBundle}`,\n params.recallContext ? `Retrieved memory:\\n${params.recallContext}` : null,\n params.graphContext.length > 0 ? `Entity graph:\\n${params.graphContext.join(\"\\n\")}` : null,\n params.causalContext.length > 0 ? `Causal trajectories:\\n${params.causalContext.join(\"\\n\")}` : null,\n params.daySummary ? `Day summary:\\n${params.daySummary}` : null,\n params.recallExplain ? `Recall explain:\\n${params.recallExplain}` : null,\n params.config.promptAppend?.trim() || null,\n \"Return either NONE or a compact summary grounded only in the supplied context.\",\n ];\n return sections.filter((value): value is string => !!value && value.trim().length > 0).join(\"\\n\\n\");\n}\n\nasync function appendActiveRecallTranscript(\n transcriptRoot: string,\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n result: ActiveRecallResult,\n queryBundle: string,\n): Promise<string> {\n const date = new Date().toISOString().slice(0, 10);\n const filePath = path.join(\n transcriptRoot,\n \"agents\",\n sanitizeTranscriptPathSegment(input.agentId),\n date,\n `${sanitizeTranscriptPathSegment(input.sessionKey)}.jsonl`,\n );\n await mkdir(path.dirname(filePath), { recursive: true });\n await appendFile(\n filePath,\n `${JSON.stringify({\n ts: new Date().toISOString(),\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n queryBundle,\n summary: result.summary,\n citations: result.citations,\n latencyMs: result.latencyMs,\n cacheHit: result.cacheHit,\n modelUsed: result.modelUsed,\n })}\\n`,\n \"utf8\",\n );\n return filePath;\n}\n\nexport function createActiveRecallEngine(\n deps: ActiveRecallDependencies,\n config: ActiveRecallConfig,\n) {\n const cache = new Map<string, CachedRecallResult>();\n const now = deps.now ?? (() => Date.now());\n\n return {\n async run(input: ActiveRecallInput): Promise<ActiveRecallResult> {\n if (!config.enabled) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"disabled\",\n transcriptPath: null,\n };\n }\n if (config.agents && !config.agents.includes(input.agentId)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n if (!config.allowedChatTypes.includes(input.chatType)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n\n const queryBundle = buildActiveRecallQueryBundle(input, config);\n const cacheKey = buildCacheKey(input, config, queryBundle);\n const currentTime = now();\n const cacheEnabled = config.cacheTtlMs > 0;\n if (cacheEnabled) {\n pruneExpiredCache(cache, currentTime);\n }\n const cached = cache.get(cacheKey);\n if (cacheEnabled && cached) {\n return {\n ...cloneRecallResult(cached.value),\n latencyMs: Math.max(0, now() - currentTime),\n cacheHit: true,\n };\n }\n\n const start = currentTime;\n const recallContext = await deps.recall(queryBundle, input.sessionKey);\n const graphContext =\n config.entityGraphDepth > 0 && deps.walkEntityGraph\n ? await deps.walkEntityGraph({\n sessionKey: input.sessionKey,\n query: queryBundle,\n depth: config.entityGraphDepth,\n })\n : [];\n const causalContext =\n config.includeCausalTrajectories && deps.loadCausalTrajectories\n ? await deps.loadCausalTrajectories({\n sessionKey: input.sessionKey,\n query: queryBundle,\n })\n : [];\n const daySummary =\n config.includeDaySummary && deps.loadDaySummary\n ? await deps.loadDaySummary(input.sessionKey)\n : null;\n const recallExplain =\n config.attachRecallExplain && deps.explainLastRecall\n ? await deps.explainLastRecall(input.sessionKey)\n : null;\n const prompt = buildActiveRecallPrompt({\n config,\n queryBundle,\n recallContext,\n graphContext,\n causalContext,\n daySummary,\n recallExplain,\n });\n\n const generated = deps.generateSummary\n ? await deps.generateSummary({\n prompt,\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n model: config.modelOverride ?? \"gpt-5.2\",\n timeoutMs: config.timeoutMs,\n thinking: config.thinking,\n fallbackPolicy: config.modelFallbackPolicy,\n })\n : {\n text: recallContext,\n modelUsed: config.modelOverride ?? \"gpt-5.2\",\n cacheHit: false,\n };\n const summary = normalizeActiveRecallSummary(\n generated.text,\n config.maxSummaryChars,\n );\n const snapshot = deps.getLastRecallSnapshot?.(input.sessionKey);\n const citations = (snapshot?.memoryIds ?? []).map((memoryId, index) => ({\n memoryId,\n relevance: Number((1 / (index + 1)).toFixed(3)),\n }));\n const result: ActiveRecallResult = {\n summary,\n citations,\n latencyMs: Math.max(0, now() - start),\n cacheHit: generated.cacheHit === true,\n modelUsed: generated.modelUsed ?? config.modelOverride ?? \"gpt-5.2\",\n transcriptPath: null,\n };\n if (config.persistTranscripts) {\n result.transcriptPath = await appendActiveRecallTranscript(\n config.transcriptDir,\n input,\n config,\n result,\n queryBundle,\n );\n }\n\n if (cacheEnabled) {\n const completedAt = now();\n cache.set(cacheKey, {\n expiresAt: completedAt + config.cacheTtlMs,\n value: cloneRecallResult(result),\n });\n enforceCacheLimit(cache);\n }\n return result;\n },\n };\n}\n"],"mappings":";;;;;;AAAA,SAAS,YAAY,aAAa;AAClC,OAAO,UAAU;AA+FjB,IAAM,kCAAkC;AAExC,IAAM,WAAW,oBAAI,IAAI;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED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SAAS,MAAM;AAAA,QACf,OAAO,OAAO,iBAAiB;AAAA,QAC/B,WAAW,OAAO;AAAA,QAClB,UAAU,OAAO;AAAA,QACjB,gBAAgB,OAAO;AAAA,MACzB,CAAC,IACD;AAAA,QACE,MAAM;AAAA,QACN,WAAW,OAAO,iBAAiB;AAAA,QACnC,UAAU;AAAA,MACZ;AACJ,YAAM,UAAU;AAAA,QACd,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AACA,YAAM,WAAW,KAAK,wBAAwB,MAAM,UAAU;AAC9D,YAAM,aAAa,UAAU,aAAa,CAAC,GAAG,IAAI,CAAC,UAAU,WAAW;AAAA,QACtE;AAAA,QACA,WAAW,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,CAAC;AAAA,MAChD,EAAE;AACF,YAAM,SAA6B;AAAA,QACjC;AAAA,QACA;AAAA,QACA,WAAW,KAAK,IAAI,GAAG,IAAI,IAAI,KAAK;AAAA,QACpC,UAAU,UAAU,aAAa;AAAA,QACjC,WAAW,UAAU,aAAa,OAAO,iBAAiB;AAAA,QAC1D,gBAAgB;AAAA,MAClB;AACA,UAAI,OAAO,oBAAoB;AAC7B,eAAO,iBAAiB,MAAM;AAAA,UAC5B,OAAO;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAEA,UAAI,cAAc;AAChB,cAAM,cAAc,IAAI;AACxB,cAAM,IAAI,UAAU;AAAA,UAClB,WAAW,cAAc,OAAO;AAAA,UAChC,OAAO,kBAAkB,MAAM;AAAA,QACjC,CAAC;AACD,0BAAkB,KAAK;AAAA,MACzB;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
package/dist/behavior-learner.js
CHANGED
package/dist/bootstrap.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PluginConfig } from './types.js';
|
|
2
|
-
import { O as Orchestrator } from './orchestrator-
|
|
2
|
+
import { O as Orchestrator } from './orchestrator-B9kwlCep.js';
|
|
3
3
|
import './buffer.js';
|
|
4
4
|
import './storage.js';
|
|
5
|
-
import './
|
|
5
|
+
import './page-versioning.js';
|
|
6
|
+
import './memory-projection-store-DeSXPh1j.js';
|
|
6
7
|
import 'better-sqlite3';
|
|
7
8
|
import './port-C1GZFv8h.js';
|
|
8
9
|
import './transcript.js';
|
|
@@ -15,7 +16,9 @@ import './negative.js';
|
|
|
15
16
|
import './recall-state.js';
|
|
16
17
|
import './session-observer-state.js';
|
|
17
18
|
import './embedding-fallback.js';
|
|
18
|
-
import './semantic-consolidation.js';
|
|
19
|
+
import './semantic-consolidation-DrvSYRdB.js';
|
|
20
|
+
import './codex-materialize-CQlLTzke.js';
|
|
21
|
+
import './logger.js';
|
|
19
22
|
import 'zod';
|
|
20
23
|
import './policy-runtime.js';
|
|
21
24
|
import './profiling.js';
|
package/dist/bootstrap.js
CHANGED
package/dist/boxes.js
CHANGED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { StorageManager } from './storage.js';
|
|
2
|
+
import { BriefingSections, BriefingFollowup, BriefingFocus, CalendarSource, CalendarEvent, MemoryFile, BriefingActiveThread, BriefingResult, EntityFile, BriefingRecentEntity } from './types.js';
|
|
3
|
+
import './page-versioning.js';
|
|
4
|
+
import './memory-projection-store-DeSXPh1j.js';
|
|
5
|
+
import 'better-sqlite3';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Daily Context Briefing (Issue #370)
|
|
9
|
+
*
|
|
10
|
+
* Produces a focused "here is what matters right now" briefing by
|
|
11
|
+
* cross-referencing active entities, recent facts, open commitments,
|
|
12
|
+
* LLM-generated follow-ups, and an optional calendar source.
|
|
13
|
+
*
|
|
14
|
+
* The module exposes:
|
|
15
|
+
* - `parseBriefingWindow(token)` — CLI-friendly window parser.
|
|
16
|
+
* - `buildBriefing(options)` — core builder that returns markdown + JSON.
|
|
17
|
+
* - `FileCalendarSource` — stub CalendarSource implementation that reads
|
|
18
|
+
* a local ICS or JSON file.
|
|
19
|
+
*
|
|
20
|
+
* ALL OpenAI usage in this module goes through the Responses API. Chat
|
|
21
|
+
* Completions is never used.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** Allowed values for the briefing format flag/field. */
|
|
25
|
+
declare const BRIEFING_FORMAT_ALLOWED: readonly ["markdown", "json"];
|
|
26
|
+
/**
|
|
27
|
+
* Default model used for the Responses API follow-up generation call.
|
|
28
|
+
* Mirrors the extraction engine default in config.ts — keep in sync.
|
|
29
|
+
*/
|
|
30
|
+
declare const BRIEFING_FOLLOWUP_DEFAULT_MODEL = "gpt-5.2";
|
|
31
|
+
type BriefingFormatValue = typeof BRIEFING_FORMAT_ALLOWED[number];
|
|
32
|
+
/**
|
|
33
|
+
* Validate a user-supplied `--format` flag value.
|
|
34
|
+
* Returns `null` when the value is valid (or `undefined`, meaning the flag
|
|
35
|
+
* was not supplied and the caller should fall back to the configured default).
|
|
36
|
+
* Returns an error message string when the value is explicitly invalid.
|
|
37
|
+
*/
|
|
38
|
+
declare function validateBriefingFormat(value: string | undefined): string | null;
|
|
39
|
+
/** Parsed briefing lookback window. */
|
|
40
|
+
interface ParsedBriefingWindow {
|
|
41
|
+
/** Start of the window (inclusive). */
|
|
42
|
+
from: Date;
|
|
43
|
+
/** End of the window (exclusive). */
|
|
44
|
+
to: Date;
|
|
45
|
+
/** Human-readable label. */
|
|
46
|
+
label: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parse a CLI-friendly window token into a concrete date range.
|
|
50
|
+
*
|
|
51
|
+
* Accepted forms (case-insensitive):
|
|
52
|
+
* - `yesterday` — the previous UTC calendar day.
|
|
53
|
+
* - `today` — the current UTC calendar day so far.
|
|
54
|
+
* - `NNh` — last N hours (e.g. `24h`, `48h`).
|
|
55
|
+
* - `NNd` — last N calendar days (e.g. `3d`, `7d`).
|
|
56
|
+
* - `NNw` — last N weeks (e.g. `1w`, `2w`).
|
|
57
|
+
*
|
|
58
|
+
* Returns `null` for invalid tokens so callers can surface a clean error.
|
|
59
|
+
*/
|
|
60
|
+
declare function parseBriefingWindow(token: string, now?: Date): ParsedBriefingWindow | null;
|
|
61
|
+
/**
|
|
62
|
+
* Parse a CLI `--focus` string into a structured focus filter.
|
|
63
|
+
*
|
|
64
|
+
* Accepted forms:
|
|
65
|
+
* - `person:Jane Doe`
|
|
66
|
+
* - `project:remnic-core`
|
|
67
|
+
* - `topic:retrieval`
|
|
68
|
+
*
|
|
69
|
+
* If no prefix is supplied, falls back to `topic:<value>`.
|
|
70
|
+
*/
|
|
71
|
+
declare function parseBriefingFocus(token: string | undefined): BriefingFocus | null;
|
|
72
|
+
/**
|
|
73
|
+
* Decide whether a memory/entity matches the given focus filter.
|
|
74
|
+
* Purely deterministic — no LLM, case-insensitive substring match across
|
|
75
|
+
* the most useful surfaces.
|
|
76
|
+
*
|
|
77
|
+
* For `entityRef` matching we also check the slugged form of the typed focus
|
|
78
|
+
* (e.g. `person:Jane Doe` → `"person-jane-doe"`) because entityRefs are stored
|
|
79
|
+
* in normalised slug form and a raw substring match on `"Jane Doe"` would never
|
|
80
|
+
* hit `"person-jane-doe"`.
|
|
81
|
+
*/
|
|
82
|
+
declare function focusMatchesMemory(memory: MemoryFile, focus: BriefingFocus): boolean;
|
|
83
|
+
declare function focusMatchesEntity(entity: EntityFile, focus: BriefingFocus): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Stub `CalendarSource` backed by a single local file. Supports:
|
|
86
|
+
* - JSON files containing an array of `CalendarEvent` records, OR a wrapper
|
|
87
|
+
* `{ events: CalendarEvent[] }` object.
|
|
88
|
+
* - Minimal ICS (`.ics`) files — extracts `VEVENT` blocks with `SUMMARY`,
|
|
89
|
+
* `DTSTART`, `DTEND`, `LOCATION`, `DESCRIPTION`, `UID`.
|
|
90
|
+
*
|
|
91
|
+
* Real calendar integrations (Google, iCloud, Microsoft) can plug into the
|
|
92
|
+
* same `CalendarSource` interface later.
|
|
93
|
+
*/
|
|
94
|
+
declare class FileCalendarSource implements CalendarSource {
|
|
95
|
+
private readonly filePath;
|
|
96
|
+
constructor(filePath: string);
|
|
97
|
+
eventsForDate(dateIso: string): Promise<CalendarEvent[]>;
|
|
98
|
+
}
|
|
99
|
+
/** @internal — exported for testing only. */
|
|
100
|
+
declare function parseIcsEvents(raw: string): CalendarEvent[];
|
|
101
|
+
/** @internal — exported for testing only. */
|
|
102
|
+
declare function eventFallsOnDate(event: CalendarEvent, dateIso: string): boolean;
|
|
103
|
+
/** Dependency-injection hook for LLM follow-up generation (used in tests). */
|
|
104
|
+
type BriefingFollowupGenerator = (prompt: {
|
|
105
|
+
sections: BriefingSections;
|
|
106
|
+
windowLabel: string;
|
|
107
|
+
maxFollowups: number;
|
|
108
|
+
}) => Promise<BriefingFollowup[]>;
|
|
109
|
+
/** Options accepted by `buildBriefing`. */
|
|
110
|
+
interface BuildBriefingOptions {
|
|
111
|
+
/** Workspace-scoped storage. Tests pass a temp dir. */
|
|
112
|
+
storage: StorageManager;
|
|
113
|
+
/** Parsed window. If omitted, a default 1-day window is used. */
|
|
114
|
+
window?: ParsedBriefingWindow;
|
|
115
|
+
/** Optional focus filter. */
|
|
116
|
+
focus?: BriefingFocus | null;
|
|
117
|
+
/** Optional namespace hint for logging. */
|
|
118
|
+
namespace?: string;
|
|
119
|
+
/** Calendar source. Section omitted entirely when undefined. */
|
|
120
|
+
calendarSource?: CalendarSource;
|
|
121
|
+
/** Maximum LLM follow-ups (0 to disable the section). */
|
|
122
|
+
maxFollowups?: number;
|
|
123
|
+
/** Whether the module is allowed to invoke the Responses API. */
|
|
124
|
+
allowLlm?: boolean;
|
|
125
|
+
/** OpenAI API key. If absent the follow-up section is gracefully omitted. */
|
|
126
|
+
openaiApiKey?: string;
|
|
127
|
+
/** OpenAI-compatible base URL (for Azure or proxied endpoints). */
|
|
128
|
+
openaiBaseUrl?: string;
|
|
129
|
+
/** Model id for the Responses call. */
|
|
130
|
+
model?: string;
|
|
131
|
+
/** Injected follow-up generator. Overrides real LLM call (tests). */
|
|
132
|
+
followupGenerator?: BriefingFollowupGenerator;
|
|
133
|
+
/** Injected "now" — makes tests deterministic. */
|
|
134
|
+
now?: Date;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Build the daily context briefing.
|
|
138
|
+
*
|
|
139
|
+
* Never throws on LLM failures — the suggested follow-ups section is simply
|
|
140
|
+
* omitted and `followupsUnavailableReason` is set.
|
|
141
|
+
*/
|
|
142
|
+
declare function buildBriefing(options: BuildBriefingOptions): Promise<BriefingResult>;
|
|
143
|
+
/** @internal — exported for testing only. */
|
|
144
|
+
declare function filterMemoriesByWindow(memories: MemoryFile[], window: ParsedBriefingWindow): MemoryFile[];
|
|
145
|
+
/** @internal — exported for testing only. */
|
|
146
|
+
declare function buildActiveThreads(memories: MemoryFile[]): BriefingActiveThread[];
|
|
147
|
+
/** @internal — exported for testing only. */
|
|
148
|
+
declare function buildRecentEntities(entities: EntityFile[], window: ParsedBriefingWindow, focus: BriefingFocus | null): BriefingRecentEntity[];
|
|
149
|
+
interface RenderContext {
|
|
150
|
+
sections: BriefingSections;
|
|
151
|
+
windowLabel: string;
|
|
152
|
+
focus: BriefingFocus | null;
|
|
153
|
+
followupsUnavailableReason?: string;
|
|
154
|
+
generatedAt: Date;
|
|
155
|
+
namespace?: string;
|
|
156
|
+
}
|
|
157
|
+
declare function renderBriefingMarkdown(ctx: RenderContext): string;
|
|
158
|
+
/**
|
|
159
|
+
* Resolve the directory where `--save` writes dated briefings.
|
|
160
|
+
* Respects the following precedence:
|
|
161
|
+
* 1. explicit `configOverride` argument
|
|
162
|
+
* 2. `$REMNIC_HOME/briefings/`
|
|
163
|
+
* 3. `$HOME/.remnic/briefings/`
|
|
164
|
+
*/
|
|
165
|
+
declare function resolveBriefingSaveDir(configOverride: string | null | undefined, env?: NodeJS.ProcessEnv): string;
|
|
166
|
+
/** Format the dated filename for a given briefing. */
|
|
167
|
+
declare function briefingFilename(date: Date, format?: "markdown" | "json"): string;
|
|
168
|
+
|
|
169
|
+
export { BRIEFING_FOLLOWUP_DEFAULT_MODEL, BRIEFING_FORMAT_ALLOWED, type BriefingFollowupGenerator, type BriefingFormatValue, type BuildBriefingOptions, FileCalendarSource, type ParsedBriefingWindow, briefingFilename, buildActiveThreads, buildBriefing, buildRecentEntities, eventFallsOnDate, filterMemoriesByWindow, focusMatchesEntity, focusMatchesMemory, parseBriefingFocus, parseBriefingWindow, parseIcsEvents, renderBriefingMarkdown, resolveBriefingSaveDir, validateBriefingFormat };
|
package/dist/briefing.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BRIEFING_FOLLOWUP_DEFAULT_MODEL,
|
|
3
|
+
BRIEFING_FORMAT_ALLOWED,
|
|
4
|
+
FileCalendarSource,
|
|
5
|
+
briefingFilename,
|
|
6
|
+
buildActiveThreads,
|
|
7
|
+
buildBriefing,
|
|
8
|
+
buildRecentEntities,
|
|
9
|
+
eventFallsOnDate,
|
|
10
|
+
filterMemoriesByWindow,
|
|
11
|
+
focusMatchesEntity,
|
|
12
|
+
focusMatchesMemory,
|
|
13
|
+
parseBriefingFocus,
|
|
14
|
+
parseBriefingWindow,
|
|
15
|
+
parseIcsEvents,
|
|
16
|
+
renderBriefingMarkdown,
|
|
17
|
+
resolveBriefingSaveDir,
|
|
18
|
+
validateBriefingFormat
|
|
19
|
+
} from "./chunk-ECKDIK5F.js";
|
|
20
|
+
import "./chunk-POMSFKTB.js";
|
|
21
|
+
import "./chunk-U2IQTSBY.js";
|
|
22
|
+
import "./chunk-4KAN3GZ3.js";
|
|
23
|
+
import "./chunk-6ZH4TU6I.js";
|
|
24
|
+
import "./chunk-6PFRXT4K.js";
|
|
25
|
+
import "./chunk-TP4FZJIZ.js";
|
|
26
|
+
import "./chunk-SCU65EZI.js";
|
|
27
|
+
import "./chunk-BOUYNNYD.js";
|
|
28
|
+
import "./chunk-QSVPYQPG.js";
|
|
29
|
+
import "./chunk-DM2T26WE.js";
|
|
30
|
+
import "./chunk-M62O4P4T.js";
|
|
31
|
+
import "./chunk-4DJQYKMN.js";
|
|
32
|
+
import "./chunk-2ODBA7MQ.js";
|
|
33
|
+
export {
|
|
34
|
+
BRIEFING_FOLLOWUP_DEFAULT_MODEL,
|
|
35
|
+
BRIEFING_FORMAT_ALLOWED,
|
|
36
|
+
FileCalendarSource,
|
|
37
|
+
briefingFilename,
|
|
38
|
+
buildActiveThreads,
|
|
39
|
+
buildBriefing,
|
|
40
|
+
buildRecentEntities,
|
|
41
|
+
eventFallsOnDate,
|
|
42
|
+
filterMemoriesByWindow,
|
|
43
|
+
focusMatchesEntity,
|
|
44
|
+
focusMatchesMemory,
|
|
45
|
+
parseBriefingFocus,
|
|
46
|
+
parseBriefingWindow,
|
|
47
|
+
parseIcsEvents,
|
|
48
|
+
renderBriefingMarkdown,
|
|
49
|
+
resolveBriefingSaveDir,
|
|
50
|
+
validateBriefingFormat
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=briefing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/buffer.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StorageManager } from './storage.js';
|
|
2
2
|
import { PluginConfig, BufferTurn } from './types.js';
|
|
3
|
-
import './
|
|
3
|
+
import './page-versioning.js';
|
|
4
|
+
import './memory-projection-store-DeSXPh1j.js';
|
|
4
5
|
import 'better-sqlite3';
|
|
5
6
|
|
|
6
7
|
type TriggerDecision = "extract_now" | "extract_batch" | "keep_buffering";
|
|
@@ -10,13 +11,26 @@ declare class SmartBuffer {
|
|
|
10
11
|
private state;
|
|
11
12
|
private loaded;
|
|
12
13
|
constructor(config: PluginConfig, storage: StorageManager);
|
|
14
|
+
private entryFor;
|
|
15
|
+
private peekEntry;
|
|
16
|
+
private normalizeState;
|
|
17
|
+
private entryActivityAt;
|
|
18
|
+
private pruneEntries;
|
|
13
19
|
load(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Reset the buffer to an empty, usable state.
|
|
22
|
+
* Called when the persisted buffer file is corrupt and load() fails,
|
|
23
|
+
* so the buffer can still accept new turns for the rest of the session.
|
|
24
|
+
*/
|
|
25
|
+
resetToEmpty(): void;
|
|
14
26
|
save(): Promise<void>;
|
|
15
|
-
addTurn(turn: BufferTurn): Promise<TriggerDecision>;
|
|
27
|
+
addTurn(bufferKey: string, turn: BufferTurn): Promise<TriggerDecision>;
|
|
16
28
|
private evaluate;
|
|
17
|
-
getTurns(): BufferTurn[];
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
getTurns(bufferKey?: string): BufferTurn[];
|
|
30
|
+
findBufferKeyForSession(sessionKey: string): Promise<string | null>;
|
|
31
|
+
findBufferKeysForSession(sessionKey: string): Promise<string[]>;
|
|
32
|
+
clearAfterExtraction(bufferKey?: string): Promise<void>;
|
|
33
|
+
getExtractionCount(bufferKey?: string): number;
|
|
20
34
|
}
|
|
21
35
|
|
|
22
36
|
export { SmartBuffer, type TriggerDecision };
|
package/dist/buffer.js
CHANGED
package/dist/calibration.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FallbackLlmClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-QKAH5B6E.js";
|
|
4
|
+
import "./chunk-KEG4GNGI.js";
|
|
5
|
+
import "./chunk-ODWDQNRE.js";
|
|
6
6
|
import "./chunk-Y27UJK6V.js";
|
|
7
7
|
import "./chunk-UZB5KHKX.js";
|
|
8
8
|
import "./chunk-MARWOCVP.js";
|
|
9
|
-
import {
|
|
10
|
-
log
|
|
11
|
-
} from "./chunk-KWBU5S5U.js";
|
|
12
9
|
import {
|
|
13
10
|
listJsonFiles
|
|
14
11
|
} from "./chunk-LPSF4OQH.js";
|
|
12
|
+
import {
|
|
13
|
+
log
|
|
14
|
+
} from "./chunk-2ODBA7MQ.js";
|
|
15
15
|
|
|
16
16
|
// src/calibration.ts
|
|
17
17
|
import { createHash } from "crypto";
|
package/dist/causal-behavior.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readChainIndex,
|
|
3
3
|
resolveChainsDir
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-3QFQGRHO.js";
|
|
5
|
+
import "./chunk-URB2WSKZ.js";
|
|
6
6
|
import {
|
|
7
7
|
normalizeRecallTokens
|
|
8
8
|
} from "./chunk-DT5TVLJE.js";
|
|
9
|
-
import {
|
|
10
|
-
log
|
|
11
|
-
} from "./chunk-KWBU5S5U.js";
|
|
12
9
|
import {
|
|
13
10
|
isRecord
|
|
14
11
|
} from "./chunk-DGXUHMOV.js";
|
|
@@ -16,6 +13,9 @@ import {
|
|
|
16
13
|
listJsonFiles,
|
|
17
14
|
readJsonFile
|
|
18
15
|
} from "./chunk-LPSF4OQH.js";
|
|
16
|
+
import {
|
|
17
|
+
log
|
|
18
|
+
} from "./chunk-2ODBA7MQ.js";
|
|
19
19
|
|
|
20
20
|
// src/causal-behavior.ts
|
|
21
21
|
import path from "path";
|
package/dist/causal-chain.js
CHANGED
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
stitchCausalChain,
|
|
7
7
|
validateCausalEdge,
|
|
8
8
|
writeChainIndex
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-3QFQGRHO.js";
|
|
10
|
+
import "./chunk-URB2WSKZ.js";
|
|
11
11
|
import "./chunk-DT5TVLJE.js";
|
|
12
|
-
import "./chunk-KWBU5S5U.js";
|
|
13
12
|
import "./chunk-DGXUHMOV.js";
|
|
14
13
|
import "./chunk-LPSF4OQH.js";
|
|
14
|
+
import "./chunk-2ODBA7MQ.js";
|
|
15
15
|
export {
|
|
16
16
|
makeEdgeId,
|
|
17
17
|
readChainIndex,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GatewayConfig } from './types.js';
|
|
1
|
+
import { GatewayConfig, PluginConfig, MemoryFile } from './types.js';
|
|
2
|
+
import { R as RolloutSummaryInput, M as MaterializeResult } from './codex-materialize-CQlLTzke.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* causal-consolidation.ts — CMC Phase 2: LLM-Assisted Causal Consolidation
|
|
@@ -55,6 +56,7 @@ declare function deriveCausalPromotionCandidates(options: {
|
|
|
55
56
|
config: ConsolidationConfig;
|
|
56
57
|
gatewayConfig?: GatewayConfig;
|
|
57
58
|
gatewayAgentId?: string;
|
|
59
|
+
pluginConfig?: PluginConfig;
|
|
58
60
|
}): Promise<CausalPatternCandidate[]>;
|
|
59
61
|
/**
|
|
60
62
|
* Get LLM-synthesized preferences from causal trajectory analysis.
|
|
@@ -67,5 +69,23 @@ declare function synthesizeCausalPreferencesViaLlm(options: {
|
|
|
67
69
|
gatewayAgentId?: string;
|
|
68
70
|
minTrajectories?: number;
|
|
69
71
|
}): Promise<string | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Optional post-consolidation hook — materializes Codex-native memory artifacts
|
|
74
|
+
* after a causal consolidation run. Guarded by `codexMaterializeMemories` and
|
|
75
|
+
* `codexMaterializeOnConsolidation`. Returns `null` when disabled or when the
|
|
76
|
+
* sentinel is missing (honors user hand-edits).
|
|
77
|
+
*
|
|
78
|
+
* Split from the orchestrator-owned flow so #378 avoids touching
|
|
79
|
+
* orchestrator.ts while Wave 1 edits are in flight.
|
|
80
|
+
*/
|
|
81
|
+
declare function materializeAfterCausalConsolidation(options: {
|
|
82
|
+
config: PluginConfig;
|
|
83
|
+
namespace?: string;
|
|
84
|
+
memories?: MemoryFile[];
|
|
85
|
+
memoryDir?: string;
|
|
86
|
+
codexHome?: string;
|
|
87
|
+
rolloutSummaries?: RolloutSummaryInput[];
|
|
88
|
+
now?: Date;
|
|
89
|
+
}): Promise<MaterializeResult | null>;
|
|
70
90
|
|
|
71
|
-
export { type CausalPatternCandidate, type ConsolidationConfig, type LlmConsolidationResult, deriveCausalPromotionCandidates, synthesizeCausalPreferencesViaLlm };
|
|
91
|
+
export { type CausalPatternCandidate, type ConsolidationConfig, type LlmConsolidationResult, deriveCausalPromotionCandidates, materializeAfterCausalConsolidation, synthesizeCausalPreferencesViaLlm };
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readChainIndex,
|
|
3
3
|
resolveChainsDir
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3QFQGRHO.js";
|
|
5
|
+
import {
|
|
6
|
+
buildExtensionsBlockForConsolidation,
|
|
7
|
+
runPostConsolidationMaterialize
|
|
8
|
+
} from "./chunk-RCICHSHL.js";
|
|
9
|
+
import "./chunk-EJI5XIBB.js";
|
|
10
|
+
import "./chunk-URB2WSKZ.js";
|
|
5
11
|
import {
|
|
6
12
|
FallbackLlmClient
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-QKAH5B6E.js";
|
|
14
|
+
import "./chunk-KEG4GNGI.js";
|
|
15
|
+
import "./chunk-ODWDQNRE.js";
|
|
10
16
|
import "./chunk-Y27UJK6V.js";
|
|
11
17
|
import "./chunk-UZB5KHKX.js";
|
|
12
|
-
import "./chunk-M5KEYE5E.js";
|
|
13
18
|
import "./chunk-MARWOCVP.js";
|
|
14
19
|
import "./chunk-DT5TVLJE.js";
|
|
15
|
-
import {
|
|
16
|
-
log
|
|
17
|
-
} from "./chunk-KWBU5S5U.js";
|
|
18
20
|
import {
|
|
19
21
|
isRecord
|
|
20
22
|
} from "./chunk-DGXUHMOV.js";
|
|
@@ -22,6 +24,21 @@ import {
|
|
|
22
24
|
listJsonFiles,
|
|
23
25
|
readJsonFile
|
|
24
26
|
} from "./chunk-LPSF4OQH.js";
|
|
27
|
+
import "./chunk-POMSFKTB.js";
|
|
28
|
+
import "./chunk-U2IQTSBY.js";
|
|
29
|
+
import "./chunk-4KAN3GZ3.js";
|
|
30
|
+
import "./chunk-6ZH4TU6I.js";
|
|
31
|
+
import "./chunk-6PFRXT4K.js";
|
|
32
|
+
import "./chunk-TP4FZJIZ.js";
|
|
33
|
+
import "./chunk-SCU65EZI.js";
|
|
34
|
+
import "./chunk-BOUYNNYD.js";
|
|
35
|
+
import "./chunk-QSVPYQPG.js";
|
|
36
|
+
import "./chunk-DM2T26WE.js";
|
|
37
|
+
import "./chunk-M62O4P4T.js";
|
|
38
|
+
import "./chunk-4DJQYKMN.js";
|
|
39
|
+
import {
|
|
40
|
+
log
|
|
41
|
+
} from "./chunk-2ODBA7MQ.js";
|
|
25
42
|
|
|
26
43
|
// src/causal-consolidation.ts
|
|
27
44
|
import { createHash } from "crypto";
|
|
@@ -165,7 +182,13 @@ async function deriveCausalPromotionCandidates(options) {
|
|
|
165
182
|
if (trajectories.length < options.config.minRecurrence) return [];
|
|
166
183
|
const chainsDir = resolveChainsDir(options.memoryDir, options.causalTrajectoryStoreDir);
|
|
167
184
|
const chainIndex = await readChainIndex(chainsDir);
|
|
168
|
-
|
|
185
|
+
let context = formatCausalContext(trajectories, chainIndex);
|
|
186
|
+
if (options.pluginConfig) {
|
|
187
|
+
const extBlock = await buildExtensionsBlockForConsolidation(options.pluginConfig);
|
|
188
|
+
if (extBlock.length > 0) {
|
|
189
|
+
context += "\n\n" + extBlock;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
169
192
|
const llm = new FallbackLlmClient(options.gatewayConfig);
|
|
170
193
|
if (!llm.isAvailable(options.gatewayAgentId)) {
|
|
171
194
|
log.debug("[cmc] no LLM available for consolidation \u2014 skipping");
|
|
@@ -205,8 +228,12 @@ async function synthesizeCausalPreferencesViaLlm(options) {
|
|
|
205
228
|
return null;
|
|
206
229
|
}
|
|
207
230
|
}
|
|
231
|
+
async function materializeAfterCausalConsolidation(options) {
|
|
232
|
+
return runPostConsolidationMaterialize("[cmc]", options);
|
|
233
|
+
}
|
|
208
234
|
export {
|
|
209
235
|
deriveCausalPromotionCandidates,
|
|
236
|
+
materializeAfterCausalConsolidation,
|
|
210
237
|
synthesizeCausalPreferencesViaLlm
|
|
211
238
|
};
|
|
212
239
|
//# sourceMappingURL=causal-consolidation.js.map
|