@remnic/core 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/abort-error.d.ts +32 -0
- package/dist/abort-error.js +11 -0
- package/dist/access-cli.d.ts +13 -3
- package/dist/access-cli.js +96 -80
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +12 -4
- package/dist/access-http.js +25 -18
- package/dist/access-mcp.d.ts +32 -4
- package/dist/access-mcp.js +16 -1
- package/dist/access-schema.d.ts +28 -28
- package/dist/access-schema.js +1 -1
- package/dist/access-service-HmO1Trrx.d.ts +732 -0
- package/dist/access-service.d.ts +15 -601
- 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-memory-bridge.js.map +1 -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-ZJLY4QSU.js → chunk-37UIFYWO.js} +130 -6
- package/dist/chunk-37UIFYWO.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-QDOSNLB4.js → chunk-3QHL5ABG.js} +17 -15
- package/dist/chunk-3QHL5ABG.js.map +1 -0
- package/dist/{chunk-6UJQNRIO.js → chunk-3SV6CQHO.js} +92 -33
- package/dist/chunk-3SV6CQHO.js.map +1 -0
- package/dist/{chunk-U4PV25RD.js → chunk-3WHVNEN7.js} +1 -1
- package/dist/chunk-3WHVNEN7.js.map +1 -0
- package/dist/{chunk-XUHI52HK.js → chunk-44ICJRF3.js} +98 -10
- package/dist/chunk-44ICJRF3.js.map +1 -0
- package/dist/{chunk-HG2NKWR2.js → chunk-47UU5PU2.js} +49 -10
- package/dist/chunk-47UU5PU2.js.map +1 -0
- 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-4LACOVZX.js +813 -0
- package/dist/chunk-4LACOVZX.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-QANCTXQF.js → chunk-6LX5ORAS.js} +3 -3
- 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-UIYZ5T3I.js → chunk-6UJ47TVX.js} +8 -8
- package/dist/chunk-6ZH4TU6I.js +245 -0
- package/dist/chunk-6ZH4TU6I.js.map +1 -0
- package/dist/{chunk-L5RPWGFK.js → chunk-7DHTMOND.js} +2 -2
- package/dist/{chunk-L7WO3MZ4.js → chunk-7ECD5ATE.js} +2 -2
- package/dist/{chunk-Q6FETXJA.js → chunk-7SEAZFFB.js} +2 -2
- package/dist/{chunk-V4YC4LUK.js → chunk-7WQ6SLIE.js} +175 -63
- package/dist/chunk-7WQ6SLIE.js.map +1 -0
- package/dist/chunk-ALXMCZEU.js +332 -0
- package/dist/chunk-ALXMCZEU.js.map +1 -0
- package/dist/{chunk-TVVVQQAK.js → chunk-BLKTA7MM.js} +58 -24
- package/dist/chunk-BLKTA7MM.js.map +1 -0
- package/dist/{chunk-SCHEKPYH.js → chunk-C2EFFULQ.js} +1 -1
- package/dist/{chunk-GJR6D6KC.js → chunk-D654IBA6.js} +2 -2
- package/dist/{chunk-OTFNI3OO.js → chunk-DEPL3635.js} +1828 -401
- package/dist/chunk-DEPL3635.js.map +1 -0
- package/dist/{chunk-UYSKNO6E.js → chunk-DHHP2Z4X.js} +15 -4
- package/dist/chunk-DHHP2Z4X.js.map +1 -0
- package/dist/{chunk-UV2FO7J4.js → chunk-E6K4NIEU.js} +2 -2
- package/dist/{chunk-T4WRIV2C.js → chunk-EABGC2TL.js} +2 -2
- 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-WWIQTB2Y.js → chunk-GGD5W7TB.js} +9 -2
- package/dist/chunk-GGD5W7TB.js.map +1 -0
- package/dist/{chunk-QWUUMMIK.js → chunk-GV6NLQ4X.js} +1355 -80
- package/dist/chunk-GV6NLQ4X.js.map +1 -0
- package/dist/{chunk-2PO5ZRKV.js → chunk-GZCUW5IC.js} +16 -3
- package/dist/chunk-GZCUW5IC.js.map +1 -0
- package/dist/{chunk-AAI7JARD.js → chunk-HMDCOMYU.js} +8 -11
- package/dist/chunk-HMDCOMYU.js.map +1 -0
- package/dist/chunk-IQT3XTKW.js +121 -0
- package/dist/chunk-IQT3XTKW.js.map +1 -0
- package/dist/{chunk-J3BT33K7.js → chunk-ITRLGI2T.js} +5 -5
- package/dist/{chunk-BDFZXRSO.js → chunk-J4IYOZZ5.js} +15 -2
- package/dist/chunk-J4IYOZZ5.js.map +1 -0
- package/dist/{chunk-J47FNDR7.js → chunk-JIU55F3X.js} +7 -7
- package/dist/{chunk-MDDAA2AO.js → chunk-JL2PU6AI.js} +17 -6
- package/dist/chunk-JL2PU6AI.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-GPGBSNKM.js → chunk-K4FLSOR5.js} +2 -2
- package/dist/chunk-KVE7R4CG.js +320 -0
- package/dist/chunk-KVE7R4CG.js.map +1 -0
- package/dist/chunk-LAYN4LDC.js +267 -0
- package/dist/chunk-LAYN4LDC.js.map +1 -0
- package/dist/{chunk-ISY75RLM.js → chunk-MBJHSA7F.js} +344 -7
- package/dist/chunk-MBJHSA7F.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-QY2BHY5O.js → chunk-MVTHXUBX.js} +297 -34
- package/dist/chunk-MVTHXUBX.js.map +1 -0
- package/dist/{chunk-LP47L3ZX.js → chunk-N42IWANG.js} +5 -5
- 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-NQEVYWX6.js} +195 -5
- package/dist/chunk-NQEVYWX6.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-OIT5QGG4.js +80 -0
- package/dist/chunk-OIT5QGG4.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-PVGDJXVK.js +21 -0
- package/dist/chunk-PVGDJXVK.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-HLXVTBF3.js → chunk-QNJMBKFK.js} +3 -2
- package/dist/chunk-QNJMBKFK.js.map +1 -0
- package/dist/{chunk-4A24LIM2.js → chunk-S75M5ZRK.js} +2 -2
- package/dist/chunk-SYUK3VLY.js +789 -0
- package/dist/chunk-SYUK3VLY.js.map +1 -0
- package/dist/{chunk-QCCCQT3O.js → chunk-TBBDFYXW.js} +2 -2
- package/dist/chunk-TBBDFYXW.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-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-W6SL7OFG.js +180 -0
- package/dist/chunk-W6SL7OFG.js.map +1 -0
- package/dist/chunk-WBSAYXVI.js +7945 -0
- package/dist/chunk-WBSAYXVI.js.map +1 -0
- package/dist/{chunk-M5ZBBBJI.js → chunk-XZ2TIKGC.js} +39 -9
- package/dist/chunk-XZ2TIKGC.js.map +1 -0
- package/dist/chunk-Y4FHOFJ2.js +140 -0
- package/dist/chunk-Y4FHOFJ2.js.map +1 -0
- package/dist/chunk-YDBIWGNI.js +298 -0
- package/dist/chunk-YDBIWGNI.js.map +1 -0
- package/dist/chunk-YNB73F22.js +137 -0
- package/dist/chunk-YNB73F22.js.map +1 -0
- package/dist/{chunk-IZME7KW2.js → chunk-ZVBB3T7V.js} +31 -12
- package/dist/chunk-ZVBB3T7V.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-BneVIEvh.d.ts +1240 -0
- package/dist/cli.d.ts +32 -1147
- package/dist/cli.js +150 -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/contradiction-review-WIUBAR52.js +21 -0
- package/dist/contradiction-review-WIUBAR52.js.map +1 -0
- package/dist/contradiction-scan-GR33PONM.js +376 -0
- package/dist/contradiction-scan-GR33PONM.js.map +1 -0
- package/dist/day-summary.d.ts +7 -2
- package/dist/day-summary.js +5 -2
- package/dist/direct-answer-wiring.d.ts +77 -0
- package/dist/direct-answer-wiring.js +75 -0
- package/dist/direct-answer-wiring.js.map +1 -0
- package/dist/direct-answer.d.ts +106 -0
- package/dist/direct-answer.js +10 -0
- package/dist/direct-answer.js.map +1 -0
- package/dist/embedding-fallback.d.ts +96 -2
- package/dist/embedding-fallback.js +6 -4
- package/dist/{engine-2A6J4XEX.js → engine-5TIQBYZR.js} +10 -7
- package/dist/engine-5TIQBYZR.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.d.ts +11 -2
- package/dist/fallback-llm.js +4 -4
- package/dist/graph.js +1 -1
- package/dist/harmonic-retrieval.js +2 -1
- package/dist/importance.d.ts +11 -1
- package/dist/importance.js +3 -1
- package/dist/index.d.ts +1027 -9
- package/dist/index.js +3303 -349
- 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.d.ts +10 -3
- 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 -15
- package/dist/{orchestrator-zTa-Qo-1.d.ts → orchestrator-DRYA6_lW.d.ts} +273 -9
- package/dist/orchestrator.d.ts +6 -3
- package/dist/orchestrator.js +76 -63
- 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 +4 -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.d.ts +28 -1
- package/dist/recall-state.js +2 -2
- package/dist/relevance.js +2 -2
- package/dist/resolution-QBTDHTG7.js +100 -0
- package/dist/resolution-QBTDHTG7.js.map +1 -0
- package/dist/resolve-provider-secret.d.ts +24 -1
- package/dist/resolve-provider-secret.js +4 -2
- package/dist/resume-bundles.js +6 -5
- package/dist/retrieval-agents.js +2 -2
- package/dist/retrieval.js +2 -2
- package/dist/schemas.d.ts +412 -54
- 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-DJhqDJUV.d.ts +50 -0
- package/dist/types.d.ts +529 -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-AAI7JARD.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-HG2NKWR2.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-IZME7KW2.js.map +0 -1
- package/dist/chunk-KL4CP4SB.js.map +0 -1
- package/dist/chunk-KWBU5S5U.js.map +0 -1
- package/dist/chunk-M5ZBBBJI.js.map +0 -1
- package/dist/chunk-MDDAA2AO.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-XUHI52HK.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 → abort-error.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-QANCTXQF.js.map → chunk-6LX5ORAS.js.map} +0 -0
- /package/dist/{chunk-UIYZ5T3I.js.map → chunk-6UJ47TVX.js.map} +0 -0
- /package/dist/{chunk-L5RPWGFK.js.map → chunk-7DHTMOND.js.map} +0 -0
- /package/dist/{chunk-L7WO3MZ4.js.map → chunk-7ECD5ATE.js.map} +0 -0
- /package/dist/{chunk-Q6FETXJA.js.map → chunk-7SEAZFFB.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-J3BT33K7.js.map → chunk-ITRLGI2T.js.map} +0 -0
- /package/dist/{chunk-J47FNDR7.js.map → chunk-JIU55F3X.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-LP47L3ZX.js.map → chunk-N42IWANG.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-OTAVQCSF.js.map → chunk-PYXS46O7.js.map} +0 -0
- /package/dist/{chunk-4A24LIM2.js.map → chunk-S75M5ZRK.js.map} +0 -0
- /package/dist/{chunk-M5KEYE5E.js.map → chunk-URB2WSKZ.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extraction-judge.ts"],"sourcesContent":["/**\n * Extraction Judge — LLM-as-judge fact-worthiness gate (issue #376).\n *\n * Evaluates extracted facts against a durability rubric before they are\n * persisted. Facts that are unlikely to be useful 30+ days from now or\n * across sessions are rejected (or shadow-logged depending on config).\n *\n * Design constraints:\n * - Corrections and principles are auto-approved (safety bypass).\n * - Critical-importance facts are auto-approved.\n * - Batches respect extractionJudgeBatchSize.\n * - Content-hash caching avoids redundant LLM calls.\n * - Performance budget: <= 1.5s per batch.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { log } from \"./logger.js\";\nimport type { PluginConfig, ImportanceLevel } from \"./types.js\";\nimport type { LocalLlmClient } from \"./local-llm.js\";\nimport type { FallbackLlmClient } from \"./fallback-llm.js\";\nimport { extractJsonCandidates } from \"./json-extract.js\";\nimport { normalizeProcedureSteps } from \"./procedural/procedure-types.js\";\n\n// ---------------------------------------------------------------------------\n// Public interfaces\n// ---------------------------------------------------------------------------\n\nexport interface JudgeCandidate {\n text: string;\n category: string;\n confidence: number;\n tags?: string[];\n /** Local importance level, set by caller before judging. */\n importanceLevel?: ImportanceLevel;\n}\n\nexport interface JudgeVerdict {\n durable: boolean;\n reason: string;\n}\n\nexport interface JudgeBatchResult {\n verdicts: Map<number, JudgeVerdict>;\n /** Number of verdicts served from cache. */\n cached: number;\n /** Number of verdicts produced by an LLM call. */\n judged: number;\n /** Total wall-clock time in milliseconds. */\n elapsed: number;\n}\n\n// ---------------------------------------------------------------------------\n// Prompt (embedded; mirrors prompts/extraction_judge.prompt.md)\n// ---------------------------------------------------------------------------\n\nconst JUDGE_SYSTEM_PROMPT = `You are a memory curator evaluating whether extracted facts are **durable** — worth storing for long-term recall across sessions.\n\nA fact is **durable** if it will still be useful 30+ days from now and is relevant across multiple sessions, not just the current task.\n\nDURABLE examples (approve):\n- Personal preferences, identities, or relationships\n- Decisions with rationale that affect future work\n- Corrections to previously held beliefs\n- Principles, rules, or constraints the user wants respected\n- Stable facts about projects, tools, or workflows\n- Commitments, deadlines, or obligations\n\nNOT DURABLE examples (reject):\n- Transient task details (\"currently debugging line 42\")\n- Ephemeral state (\"the build is running now\")\n- Routine operations (\"ran npm install\")\n- Conversational filler or acknowledgements\n- Information that will be stale within hours\n- Step-by-step instructions for a one-time task\n\nReturn a JSON array of objects with these fields:\n- index: number (the candidate index)\n- durable: boolean (true if the fact is durable)\n- reason: string (brief explanation)\n\nRules:\n1. Return exactly one verdict per input candidate, matched by index.\n2. The reason field must be a short phrase (under 80 characters).\n3. When in doubt lean toward durable — false negatives are worse than false positives.\n4. Output valid JSON only. No markdown fences, no commentary.\n\nExample output:\n[{\"index\": 0, \"durable\": true, \"reason\": \"Stable personal preference\"}, {\"index\": 1, \"durable\": false, \"reason\": \"Ephemeral build status\"}]`;\n\n// ---------------------------------------------------------------------------\n// Content-hash cache (in-memory, per-process fallback)\n// ---------------------------------------------------------------------------\n\n/** Maximum entries before evicting the oldest half. */\nconst VERDICT_CACHE_MAX_SIZE = 10_000;\n\n/** Module-level fallback cache, used when callers do not pass their own. */\nconst defaultVerdictCache = new Map<string, JudgeVerdict>();\n\nfunction cacheKey(text: string, category: string): string {\n return createHash(\"sha256\").update(`${text}\\0${category}`).digest(\"hex\");\n}\n\n/**\n * Enforce the max-size invariant on a verdict cache. When the cache exceeds\n * VERDICT_CACHE_MAX_SIZE, the oldest half of entries are deleted (Map\n * iteration order is insertion order).\n */\nfunction enforceMaxCacheSize(cache: Map<string, JudgeVerdict>): void {\n if (cache.size <= VERDICT_CACHE_MAX_SIZE) return;\n const deleteCount = Math.floor(cache.size / 2);\n let deleted = 0;\n for (const key of cache.keys()) {\n if (deleted >= deleteCount) break;\n cache.delete(key);\n deleted++;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Categories that bypass the judge (safety / correctness)\n// ---------------------------------------------------------------------------\n\nconst AUTO_APPROVE_CATEGORIES = new Set([\"correction\", \"principle\"]);\n\n/** Explicit trigger phrasing — procedures must match to persist (issue #519). */\nconst PROCEDURE_TRIGGER_RE =\n /(when you|whenever|before you|before running|always\\s|first\\b.*\\bthen|to deploy|to ship|run these steps|follow these steps|how (i|we)\\s|recipe for|workflow|each time you)/i;\n\n/**\n * Deterministic gate for extracted `procedure` memories: ≥2 steps with non-empty\n * intents and explicit trigger wording in title and/or steps.\n */\nexport function validateProcedureExtraction(input: {\n content: string;\n procedureSteps?: unknown;\n}): JudgeVerdict {\n const steps = normalizeProcedureSteps(input.procedureSteps);\n if (steps.length < 2) {\n return { durable: false, reason: \"Procedure requires at least two steps with intents\" };\n }\n const combined = [input.content, ...steps.map((s) => s.intent)].join(\" \").toLowerCase();\n if (!PROCEDURE_TRIGGER_RE.test(combined)) {\n return { durable: false, reason: \"Procedure missing explicit trigger phrasing\" };\n }\n return { durable: true, reason: \"Procedure structure validated\" };\n}\n\n// ---------------------------------------------------------------------------\n// Core judge function\n// ---------------------------------------------------------------------------\n\n/**\n * Evaluate a batch of candidate facts for durability.\n *\n * Auto-approves corrections, principles, and critical-importance facts.\n * Remaining candidates are batched (up to extractionJudgeBatchSize),\n * checked against an in-memory content-hash cache, and sent to the LLM\n * for verdict.\n */\nexport async function judgeFactDurability(\n candidates: JudgeCandidate[],\n config: PluginConfig,\n localLlm: LocalLlmClient | null,\n fallbackLlm: FallbackLlmClient | null,\n cache?: Map<string, JudgeVerdict>,\n): Promise<JudgeBatchResult> {\n const startMs = Date.now();\n const verdicts = new Map<number, JudgeVerdict>();\n let cached = 0;\n let judged = 0;\n\n // Use caller-provided cache for per-orchestrator scoping, or fall back\n // to the module-level default cache.\n const verdictCache = cache ?? defaultVerdictCache;\n\n if (candidates.length === 0) {\n return { verdicts, cached, judged, elapsed: 0 };\n }\n\n // Indices that need LLM judgment\n const pendingIndices: number[] = [];\n\n for (let i = 0; i < candidates.length; i++) {\n const c = candidates[i];\n\n // Auto-approve safety categories\n if (AUTO_APPROVE_CATEGORIES.has(c.category)) {\n verdicts.set(i, {\n durable: true,\n reason: `Auto-approved: ${c.category} category bypasses judge`,\n });\n continue;\n }\n\n // Auto-approve critical importance\n if (c.importanceLevel === \"critical\") {\n verdicts.set(i, {\n durable: true,\n reason: \"Auto-approved: critical importance\",\n });\n continue;\n }\n\n // Check cache\n const key = cacheKey(c.text, c.category);\n const cachedVerdict = verdictCache.get(key);\n if (cachedVerdict) {\n verdicts.set(i, cachedVerdict);\n cached++;\n continue;\n }\n\n pendingIndices.push(i);\n }\n\n // If all resolved without LLM, return early\n if (pendingIndices.length === 0) {\n return { verdicts, cached, judged, elapsed: Date.now() - startMs };\n }\n\n // Batch the pending candidates up to batchSize\n const batchSize = config.extractionJudgeBatchSize;\n for (let batchStart = 0; batchStart < pendingIndices.length; batchStart += batchSize) {\n const batchIndices = pendingIndices.slice(batchStart, batchStart + batchSize);\n const batchPayload = batchIndices.map((idx) => ({\n index: idx,\n text: candidates[idx].text,\n category: candidates[idx].category,\n confidence: candidates[idx].confidence,\n }));\n\n const userPrompt = JSON.stringify(batchPayload);\n\n try {\n const llmResponse = await callJudgeLlm(\n userPrompt,\n config,\n localLlm,\n fallbackLlm,\n );\n\n if (llmResponse) {\n const parsed = parseJudgeResponse(llmResponse, batchIndices);\n for (const [idx, verdict] of parsed.entries()) {\n verdicts.set(idx, verdict);\n judged++;\n // Cache the verdict\n const c = candidates[idx];\n verdictCache.set(cacheKey(c.text, c.category), verdict);\n }\n // Evict oldest entries if cache exceeds max size\n enforceMaxCacheSize(verdictCache);\n }\n } catch (err) {\n // Fail-open: if the LLM call fails, approve all candidates in this batch\n log.warn(\n `extraction-judge: LLM call failed, approving batch (fail-open): ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n\n // Fill in any missing verdicts from this batch (fail-open: approve)\n for (const idx of batchIndices) {\n if (!verdicts.has(idx)) {\n verdicts.set(idx, {\n durable: true,\n reason: \"Approved by default (judge unavailable or parse error)\",\n });\n }\n }\n }\n\n return { verdicts, cached, judged, elapsed: Date.now() - startMs };\n}\n\n// ---------------------------------------------------------------------------\n// LLM call helpers\n// ---------------------------------------------------------------------------\n\nasync function callJudgeLlm(\n userPrompt: string,\n config: PluginConfig,\n localLlm: LocalLlmClient | null,\n fallbackLlm: FallbackLlmClient | null,\n): Promise<string | null> {\n const messages: Array<{ role: \"system\" | \"user\"; content: string }> = [\n { role: \"system\", content: JUDGE_SYSTEM_PROMPT },\n { role: \"user\", content: userPrompt },\n ];\n\n const modelOverride = config.extractionJudgeModel || undefined;\n\n // When modelSource is \"gateway\", skip localLlm and go directly to fallback\n // (the gateway-routed backend). This respects the operator's explicit\n // routing preference.\n const skipLocal = config.modelSource === \"gateway\";\n\n // Resolve the gateway agent ID so the fallback LLM routes through the\n // correct agent persona's model chain — identical to the pattern used\n // by ExtractionEngine.withGatewayAgent().\n const agentId =\n config.modelSource === \"gateway\"\n ? (config.gatewayAgentId || undefined)\n : undefined;\n\n // Try local LLM first (unless modelSource says gateway)\n if (localLlm && !skipLocal) {\n try {\n const result = await (localLlm as any).chatCompletion(messages, {\n temperature: 0.1,\n maxTokens: 2048,\n responseFormat: { type: \"json_object\" },\n timeoutMs: 1500,\n operation: \"extraction-judge\",\n ...(modelOverride ? { model: modelOverride } : {}),\n });\n if (result?.content) {\n return result.content;\n }\n } catch (err) {\n log.debug(\n `extraction-judge: local LLM failed, trying fallback: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n\n // Try fallback LLM\n if (fallbackLlm) {\n try {\n const result = await fallbackLlm.chatCompletion(\n messages as Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n {\n temperature: 0.1,\n maxTokens: 2048,\n timeoutMs: 1500,\n ...(modelOverride ? { model: modelOverride } : {}),\n ...(agentId ? { agentId } : {}),\n },\n );\n if (result?.content) {\n return result.content;\n }\n } catch (err) {\n log.debug(\n `extraction-judge: fallback LLM failed: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Response parsing\n// ---------------------------------------------------------------------------\n\nfunction parseJudgeResponse(\n raw: string,\n expectedIndices: number[],\n): Map<number, JudgeVerdict> {\n const result = new Map<number, JudgeVerdict>();\n const expectedSet = new Set(expectedIndices);\n\n try {\n // Try direct parse first, then fall back to JSON extraction\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n const candidates = extractJsonCandidates(raw);\n if (candidates.length > 0) {\n parsed = JSON.parse(candidates[0]);\n }\n }\n\n if (!Array.isArray(parsed)) {\n // Might be wrapped in an object with a key\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n const values = Object.values(parsed as Record<string, unknown>);\n for (const v of values) {\n if (Array.isArray(v)) {\n parsed = v;\n break;\n }\n }\n }\n if (!Array.isArray(parsed)) {\n log.debug(\"extraction-judge: response is not an array, cannot parse\");\n return result;\n }\n }\n\n for (const item of parsed) {\n if (\n typeof item !== \"object\" ||\n item === null ||\n typeof (item as any).index !== \"number\"\n ) {\n continue;\n }\n const idx = (item as any).index as number;\n if (!expectedSet.has(idx)) continue;\n\n const durable =\n typeof (item as any).durable === \"boolean\"\n ? (item as any).durable\n : true; // fail-open\n const reason =\n typeof (item as any).reason === \"string\"\n ? ((item as any).reason as string).slice(0, 120)\n : \"No reason provided\";\n\n result.set(idx, { durable, reason });\n }\n } catch (err) {\n log.debug(\n `extraction-judge: failed to parse response: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Cache management (exposed for testing)\n// ---------------------------------------------------------------------------\n\n/** Clear the in-memory default verdict cache. Primarily for tests. */\nexport function clearVerdictCache(): void {\n defaultVerdictCache.clear();\n}\n\n/** Return the current default verdict cache size. Primarily for tests. */\nexport function verdictCacheSize(): number {\n return defaultVerdictCache.size;\n}\n\n/** Create a new per-instance verdict cache. Orchestrators should hold one. */\nexport function createVerdictCache(): Map<string, JudgeVerdict> {\n return new Map();\n}\n"],"mappings":"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","names":[]}
|
|
@@ -5,12 +5,43 @@ import {
|
|
|
5
5
|
readEnvVar,
|
|
6
6
|
resolveHomeDir
|
|
7
7
|
} from "./chunk-MARWOCVP.js";
|
|
8
|
+
import {
|
|
9
|
+
normalizeEntitySchemas
|
|
10
|
+
} from "./chunk-4DJQYKMN.js";
|
|
8
11
|
import {
|
|
9
12
|
log
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2ODBA7MQ.js";
|
|
11
14
|
|
|
12
15
|
// src/config.ts
|
|
13
16
|
import path from "path";
|
|
17
|
+
|
|
18
|
+
// src/connectors/coerce.ts
|
|
19
|
+
function coerceBool(value) {
|
|
20
|
+
if (typeof value === "boolean") return value;
|
|
21
|
+
if (typeof value === "string") {
|
|
22
|
+
const v = value.trim().toLowerCase();
|
|
23
|
+
if (["false", "0", "no", "off"].includes(v)) return false;
|
|
24
|
+
if (["true", "1", "yes", "on"].includes(v)) return true;
|
|
25
|
+
}
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
function coerceInstallExtension(value) {
|
|
29
|
+
return coerceBool(value);
|
|
30
|
+
}
|
|
31
|
+
function coerceNumber(value) {
|
|
32
|
+
if (typeof value === "number") {
|
|
33
|
+
return Number.isFinite(value) ? value : void 0;
|
|
34
|
+
}
|
|
35
|
+
if (typeof value === "string") {
|
|
36
|
+
const trimmed = value.trim();
|
|
37
|
+
if (trimmed.length === 0) return void 0;
|
|
38
|
+
const n = Number(trimmed);
|
|
39
|
+
return Number.isFinite(n) ? n : void 0;
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/config.ts
|
|
14
45
|
var DEFAULT_MEMORY_DIR = path.join(
|
|
15
46
|
resolveHomeDir(),
|
|
16
47
|
".openclaw",
|
|
@@ -68,6 +99,44 @@ function normalizeMemoryRelativeDir(raw, fallback) {
|
|
|
68
99
|
const normalized = trimmed.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0 && segment !== "." && segment !== "..").join("/");
|
|
69
100
|
return normalized.length > 0 ? normalized : fallback;
|
|
70
101
|
}
|
|
102
|
+
function parseContradictionScanConfig(raw) {
|
|
103
|
+
if (!raw || typeof raw !== "object") {
|
|
104
|
+
return {
|
|
105
|
+
enabled: false,
|
|
106
|
+
similarityFloor: 0.82,
|
|
107
|
+
topicOverlapFloor: 0.4,
|
|
108
|
+
maxPairsPerRun: 500,
|
|
109
|
+
cooldownDays: 14,
|
|
110
|
+
autoMergeDuplicates: false
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const src = raw;
|
|
114
|
+
const simFloor = coerceNumber(src.similarityFloor) ?? 0.82;
|
|
115
|
+
const topicFloor = coerceNumber(src.topicOverlapFloor) ?? 0.4;
|
|
116
|
+
const maxPairs = coerceNumber(src.maxPairsPerRun) ?? 500;
|
|
117
|
+
const cooldown = coerceNumber(src.cooldownDays) ?? 14;
|
|
118
|
+
return {
|
|
119
|
+
enabled: coerceBool(src.enabled) === true,
|
|
120
|
+
similarityFloor: Math.min(1, Math.max(0, simFloor)),
|
|
121
|
+
topicOverlapFloor: Math.min(1, Math.max(0, topicFloor)),
|
|
122
|
+
maxPairsPerRun: Math.max(1, maxPairs),
|
|
123
|
+
cooldownDays: Math.max(0, cooldown),
|
|
124
|
+
autoMergeDuplicates: coerceBool(src.autoMergeDuplicates) === true
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function parseSemanticChunkingConfig(raw) {
|
|
128
|
+
if (!raw || typeof raw !== "object") return {};
|
|
129
|
+
const src = raw;
|
|
130
|
+
const out = {};
|
|
131
|
+
if (typeof src.targetTokens === "number") out.targetTokens = src.targetTokens;
|
|
132
|
+
if (typeof src.minTokens === "number") out.minTokens = src.minTokens;
|
|
133
|
+
if (typeof src.maxTokens === "number") out.maxTokens = src.maxTokens;
|
|
134
|
+
if (typeof src.smoothingWindowSize === "number") out.smoothingWindowSize = src.smoothingWindowSize;
|
|
135
|
+
if (typeof src.boundaryThresholdStdDevs === "number") out.boundaryThresholdStdDevs = src.boundaryThresholdStdDevs;
|
|
136
|
+
if (typeof src.embeddingBatchSize === "number") out.embeddingBatchSize = src.embeddingBatchSize;
|
|
137
|
+
if (typeof src.fallbackToRecursive === "boolean") out.fallbackToRecursive = src.fallbackToRecursive;
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
71
140
|
var VALID_EFFORTS = ["none", "low", "medium", "high"];
|
|
72
141
|
var VALID_TRIGGERS = ["smart", "every_n", "time_based"];
|
|
73
142
|
var VALID_IDENTITY_INJECTION_MODES = ["recovery_only", "minimal", "full"];
|
|
@@ -77,6 +146,8 @@ var VALID_MEMORY_OS_PRESETS = [
|
|
|
77
146
|
"research-max",
|
|
78
147
|
"local-llm-heavy"
|
|
79
148
|
];
|
|
149
|
+
var VALID_SLOT_MISMATCH_MODES = ["error", "warn", "silent"];
|
|
150
|
+
var VALID_CODEX_COMPACTION_FLUSH_MODES = ["signal", "heuristic", "auto"];
|
|
80
151
|
var VALID_MEMORY_CATEGORIES = /* @__PURE__ */ new Set([
|
|
81
152
|
"fact",
|
|
82
153
|
"preference",
|
|
@@ -88,7 +159,8 @@ var VALID_MEMORY_CATEGORIES = /* @__PURE__ */ new Set([
|
|
|
88
159
|
"commitment",
|
|
89
160
|
"moment",
|
|
90
161
|
"skill",
|
|
91
|
-
"rule"
|
|
162
|
+
"rule",
|
|
163
|
+
"procedure"
|
|
92
164
|
]);
|
|
93
165
|
var DEFAULT_BEHAVIOR_LOOP_PROTECTED_PARAMS = [
|
|
94
166
|
"maxMemoryTokens",
|
|
@@ -219,6 +291,64 @@ function parseConfig(raw) {
|
|
|
219
291
|
const reasoningEffort = rawEffort && VALID_EFFORTS.includes(rawEffort) ? rawEffort : "low";
|
|
220
292
|
const rawTrigger = cfg.triggerMode;
|
|
221
293
|
const triggerMode = rawTrigger && VALID_TRIGGERS.includes(rawTrigger) ? rawTrigger : "smart";
|
|
294
|
+
const rawSlotBehavior = cfg.slotBehavior && typeof cfg.slotBehavior === "object" && !Array.isArray(cfg.slotBehavior) ? cfg.slotBehavior : {};
|
|
295
|
+
const slotBehavior = {
|
|
296
|
+
requireExclusiveMemorySlot: rawSlotBehavior.requireExclusiveMemorySlot !== false,
|
|
297
|
+
onSlotMismatch: typeof rawSlotBehavior.onSlotMismatch === "string" && VALID_SLOT_MISMATCH_MODES.includes(
|
|
298
|
+
rawSlotBehavior.onSlotMismatch
|
|
299
|
+
) ? rawSlotBehavior.onSlotMismatch : "error"
|
|
300
|
+
};
|
|
301
|
+
const rawDreaming = cfg.dreaming && typeof cfg.dreaming === "object" && !Array.isArray(cfg.dreaming) ? cfg.dreaming : {};
|
|
302
|
+
const dreaming = {
|
|
303
|
+
enabled: rawDreaming.enabled === true,
|
|
304
|
+
journalPath: typeof rawDreaming.journalPath === "string" && rawDreaming.journalPath.trim().length > 0 ? rawDreaming.journalPath.trim() : "DREAMS.md",
|
|
305
|
+
maxEntries: typeof rawDreaming.maxEntries === "number" ? rawDreaming.maxEntries === 0 ? 0 : rawDreaming.maxEntries < 0 ? 500 : rawDreaming.maxEntries < 10 ? 500 : Math.min(1e4, Math.floor(rawDreaming.maxEntries)) : 500,
|
|
306
|
+
injectRecentCount: typeof rawDreaming.injectRecentCount === "number" ? Math.min(20, Math.max(0, Math.floor(rawDreaming.injectRecentCount))) : 3,
|
|
307
|
+
minIntervalMinutes: typeof rawDreaming.minIntervalMinutes === "number" ? Math.max(1, Math.floor(rawDreaming.minIntervalMinutes)) : 120,
|
|
308
|
+
narrativeModel: typeof rawDreaming.narrativeModel === "string" && rawDreaming.narrativeModel.trim().length > 0 ? rawDreaming.narrativeModel.trim() : null,
|
|
309
|
+
narrativePromptStyle: rawDreaming.narrativePromptStyle === "diary" || rawDreaming.narrativePromptStyle === "analytical" ? rawDreaming.narrativePromptStyle : "reflective",
|
|
310
|
+
watchFile: rawDreaming.watchFile !== false
|
|
311
|
+
};
|
|
312
|
+
const rawHeartbeat = cfg.heartbeat && typeof cfg.heartbeat === "object" && !Array.isArray(cfg.heartbeat) ? cfg.heartbeat : {};
|
|
313
|
+
const heartbeat = {
|
|
314
|
+
enabled: rawHeartbeat.enabled === true,
|
|
315
|
+
journalPath: typeof rawHeartbeat.journalPath === "string" && rawHeartbeat.journalPath.trim().length > 0 ? rawHeartbeat.journalPath.trim() : "HEARTBEAT.md",
|
|
316
|
+
maxPreviousRuns: typeof rawHeartbeat.maxPreviousRuns === "number" ? Math.min(20, Math.max(0, Math.floor(rawHeartbeat.maxPreviousRuns))) : 5,
|
|
317
|
+
watchFile: rawHeartbeat.watchFile !== false,
|
|
318
|
+
detectionMode: rawHeartbeat.detectionMode === "runtime-signal" || rawHeartbeat.detectionMode === "heuristic" ? rawHeartbeat.detectionMode : "auto",
|
|
319
|
+
gateExtractionDuringHeartbeat: rawHeartbeat.gateExtractionDuringHeartbeat !== false
|
|
320
|
+
};
|
|
321
|
+
const rawCodexCompat = cfg.codexCompat && typeof cfg.codexCompat === "object" && !Array.isArray(cfg.codexCompat) ? cfg.codexCompat : {};
|
|
322
|
+
const codexCompat = {
|
|
323
|
+
enabled: rawCodexCompat.enabled === true,
|
|
324
|
+
threadIdBufferKeying: rawCodexCompat.threadIdBufferKeying !== false,
|
|
325
|
+
compactionFlushMode: typeof rawCodexCompat.compactionFlushMode === "string" && VALID_CODEX_COMPACTION_FLUSH_MODES.includes(
|
|
326
|
+
rawCodexCompat.compactionFlushMode
|
|
327
|
+
) ? rawCodexCompat.compactionFlushMode : "auto",
|
|
328
|
+
fingerprintDedup: rawCodexCompat.fingerprintDedup !== false
|
|
329
|
+
};
|
|
330
|
+
const rawProcedural = cfg.procedural && typeof cfg.procedural === "object" && !Array.isArray(cfg.procedural) ? cfg.procedural : {};
|
|
331
|
+
const proceduralMinCoerced = coerceNumber(rawProcedural.minOccurrences);
|
|
332
|
+
const proceduralMinRaw = proceduralMinCoerced !== void 0 ? Math.floor(proceduralMinCoerced) : 3;
|
|
333
|
+
const successFloorRaw = coerceNumber(rawProcedural.successFloor);
|
|
334
|
+
const successFloor = successFloorRaw !== void 0 && successFloorRaw >= 0 && successFloorRaw <= 1 ? successFloorRaw : 0.7;
|
|
335
|
+
const autoPromoteOccRaw = coerceNumber(rawProcedural.autoPromoteOccurrences);
|
|
336
|
+
const autoPromoteOccurrences = autoPromoteOccRaw !== void 0 && Number.isFinite(autoPromoteOccRaw) ? autoPromoteOccRaw <= 0 ? 0 : Math.min(1e4, Math.max(1, Math.floor(autoPromoteOccRaw))) : 8;
|
|
337
|
+
const lookbackCoerced = coerceNumber(rawProcedural.lookbackDays);
|
|
338
|
+
const lookbackDays = lookbackCoerced !== void 0 && Number.isFinite(lookbackCoerced) ? Math.min(3650, Math.max(1, Math.floor(lookbackCoerced))) : 30;
|
|
339
|
+
const recallMaxCoerced = coerceNumber(rawProcedural.recallMaxProcedures);
|
|
340
|
+
const recallMaxProcedures = recallMaxCoerced !== void 0 && Number.isFinite(recallMaxCoerced) ? Math.min(10, Math.max(1, Math.floor(recallMaxCoerced))) : 3;
|
|
341
|
+
const procedural = {
|
|
342
|
+
enabled: coerceBool(rawProcedural.enabled) === true,
|
|
343
|
+
/** `0` skips all mining (`minOccurrences_zero`); otherwise clusters need at least this many members. */
|
|
344
|
+
minOccurrences: Math.min(1e3, Math.max(0, proceduralMinRaw)),
|
|
345
|
+
successFloor,
|
|
346
|
+
autoPromoteOccurrences,
|
|
347
|
+
autoPromoteEnabled: coerceBool(rawProcedural.autoPromoteEnabled) === true,
|
|
348
|
+
lookbackDays,
|
|
349
|
+
proceduralMiningCronAutoRegister: coerceBool(rawProcedural.proceduralMiningCronAutoRegister) === true,
|
|
350
|
+
recallMaxProcedures
|
|
351
|
+
};
|
|
222
352
|
const memoryDir = typeof cfg.memoryDir === "string" && cfg.memoryDir.length > 0 ? cfg.memoryDir : DEFAULT_MEMORY_DIR;
|
|
223
353
|
const rawIdentityInjectionMode = cfg.identityInjectionMode;
|
|
224
354
|
const identityInjectionMode = rawIdentityInjectionMode && VALID_IDENTITY_INJECTION_MODES.includes(rawIdentityInjectionMode) ? rawIdentityInjectionMode : "recovery_only";
|
|
@@ -232,6 +362,7 @@ function parseConfig(raw) {
|
|
|
232
362
|
match: typeof r?.match === "string" ? r.match : "",
|
|
233
363
|
principal: typeof r?.principal === "string" ? r.principal : ""
|
|
234
364
|
})).filter((r) => r.match.length > 0 && r.principal.length > 0) : [];
|
|
365
|
+
const entitySchemas = normalizeEntitySchemas(cfg.entitySchemas);
|
|
235
366
|
const rawHygiene = cfg.fileHygiene && typeof cfg.fileHygiene === "object" && !Array.isArray(cfg.fileHygiene) ? cfg.fileHygiene : void 0;
|
|
236
367
|
const hygieneEnabled = rawHygiene?.enabled === true;
|
|
237
368
|
const fileHygiene = hygieneEnabled ? {
|
|
@@ -391,12 +522,45 @@ function parseConfig(raw) {
|
|
|
391
522
|
chunkingTargetTokens: typeof cfg.chunkingTargetTokens === "number" ? cfg.chunkingTargetTokens : 200,
|
|
392
523
|
chunkingMinTokens: typeof cfg.chunkingMinTokens === "number" ? cfg.chunkingMinTokens : 150,
|
|
393
524
|
chunkingOverlapSentences: typeof cfg.chunkingOverlapSentences === "number" ? cfg.chunkingOverlapSentences : 2,
|
|
525
|
+
// Semantic Chunking (Issue #368)
|
|
526
|
+
semanticChunkingEnabled: cfg.semanticChunkingEnabled === true,
|
|
527
|
+
semanticChunkingConfig: parseSemanticChunkingConfig(cfg.semanticChunkingConfig),
|
|
394
528
|
// Contradiction Detection (Phase 2B)
|
|
395
529
|
contradictionDetectionEnabled: cfg.contradictionDetectionEnabled === true,
|
|
396
530
|
// Off by default initially
|
|
397
531
|
contradictionSimilarityThreshold: typeof cfg.contradictionSimilarityThreshold === "number" ? cfg.contradictionSimilarityThreshold : 0.7,
|
|
398
532
|
contradictionMinConfidence: typeof cfg.contradictionMinConfidence === "number" ? cfg.contradictionMinConfidence : 0.9,
|
|
399
533
|
contradictionAutoResolve: cfg.contradictionAutoResolve !== false,
|
|
534
|
+
// Contradiction Scan cron (issue #520)
|
|
535
|
+
contradictionScan: parseContradictionScanConfig(cfg.contradictionScan),
|
|
536
|
+
// Temporal Supersession (issue #375)
|
|
537
|
+
temporalSupersessionEnabled: cfg.temporalSupersessionEnabled !== false,
|
|
538
|
+
// On by default
|
|
539
|
+
temporalSupersessionIncludeInRecall: cfg.temporalSupersessionIncludeInRecall === true,
|
|
540
|
+
// Off by default
|
|
541
|
+
// Direct-answer retrieval tier (issue #518). Default on — the
|
|
542
|
+
// tier runs in observation mode: it annotates
|
|
543
|
+
// LastRecallSnapshot.tierExplain but never short-circuits the
|
|
544
|
+
// QMD path. Operators can opt out with
|
|
545
|
+
// recallDirectAnswerEnabled=false.
|
|
546
|
+
recallDirectAnswerEnabled: coerceBool(cfg.recallDirectAnswerEnabled) ?? true,
|
|
547
|
+
recallDirectAnswerTokenOverlapFloor: (() => {
|
|
548
|
+
const n = coerceNumber(cfg.recallDirectAnswerTokenOverlapFloor);
|
|
549
|
+
return n !== void 0 && n >= 0 && n <= 1 ? n : 0.55;
|
|
550
|
+
})(),
|
|
551
|
+
recallDirectAnswerImportanceFloor: (() => {
|
|
552
|
+
const n = coerceNumber(cfg.recallDirectAnswerImportanceFloor);
|
|
553
|
+
return n !== void 0 && n >= 0 && n <= 1 ? n : 0.7;
|
|
554
|
+
})(),
|
|
555
|
+
recallDirectAnswerAmbiguityMargin: (() => {
|
|
556
|
+
const n = coerceNumber(cfg.recallDirectAnswerAmbiguityMargin);
|
|
557
|
+
return n !== void 0 && n >= 0 && n <= 1 ? n : 0.15;
|
|
558
|
+
})(),
|
|
559
|
+
recallDirectAnswerEligibleTaxonomyBuckets: Array.isArray(
|
|
560
|
+
cfg.recallDirectAnswerEligibleTaxonomyBuckets
|
|
561
|
+
) ? cfg.recallDirectAnswerEligibleTaxonomyBuckets.filter(
|
|
562
|
+
(v) => typeof v === "string" && v.length > 0
|
|
563
|
+
) : ["decisions", "principles", "conventions", "runbooks", "entities"],
|
|
400
564
|
// Memory Linking (Phase 3A)
|
|
401
565
|
memoryLinkingEnabled: cfg.memoryLinkingEnabled === true,
|
|
402
566
|
// Off by default initially
|
|
@@ -432,6 +596,50 @@ function parseConfig(raw) {
|
|
|
432
596
|
checkpointTurns: typeof cfg.checkpointTurns === "number" ? cfg.checkpointTurns : 15,
|
|
433
597
|
// Compaction reset (opt-in, default: false)
|
|
434
598
|
compactionResetEnabled: cfg.compactionResetEnabled === true,
|
|
599
|
+
beforeResetTimeoutMs: typeof cfg.beforeResetTimeoutMs === "number" ? Math.min(3e4, Math.max(100, Math.floor(cfg.beforeResetTimeoutMs))) : 2e3,
|
|
600
|
+
flushOnResetEnabled: cfg.flushOnResetEnabled !== false,
|
|
601
|
+
commandsListEnabled: cfg.commandsListEnabled !== false,
|
|
602
|
+
openclawToolsEnabled: cfg.openclawToolsEnabled !== false,
|
|
603
|
+
openclawToolSnippetMaxChars: typeof cfg.openclawToolSnippetMaxChars === "number" ? Math.min(4e3, Math.max(80, Math.floor(cfg.openclawToolSnippetMaxChars))) : 600,
|
|
604
|
+
sessionTogglesEnabled: cfg.sessionTogglesEnabled !== false,
|
|
605
|
+
verboseRecallVisibility: cfg.verboseRecallVisibility !== false,
|
|
606
|
+
recallTranscriptsEnabled: cfg.recallTranscriptsEnabled === true,
|
|
607
|
+
recallTranscriptRetentionDays: typeof cfg.recallTranscriptRetentionDays === "number" ? Math.min(365, Math.max(1, Math.floor(cfg.recallTranscriptRetentionDays))) : 30,
|
|
608
|
+
respectBundledActiveMemoryToggle: cfg.respectBundledActiveMemoryToggle !== false,
|
|
609
|
+
activeRecallEnabled: cfg.activeRecallEnabled === true,
|
|
610
|
+
activeRecallAgents: Array.isArray(cfg.activeRecallAgents) && cfg.activeRecallAgents.length > 0 ? cfg.activeRecallAgents.filter((value) => typeof value === "string" && value.trim().length > 0).map((value) => value.trim()) : null,
|
|
611
|
+
activeRecallAllowedChatTypes: Array.isArray(cfg.activeRecallAllowedChatTypes) && cfg.activeRecallAllowedChatTypes.length > 0 ? cfg.activeRecallAllowedChatTypes.filter(
|
|
612
|
+
(value) => value === "direct" || value === "group" || value === "channel"
|
|
613
|
+
) : ["direct", "group", "channel"],
|
|
614
|
+
activeRecallQueryMode: cfg.activeRecallQueryMode === "message" || cfg.activeRecallQueryMode === "full" ? cfg.activeRecallQueryMode : "recent",
|
|
615
|
+
activeRecallPromptStyle: cfg.activeRecallPromptStyle === "strict" || cfg.activeRecallPromptStyle === "contextual" || cfg.activeRecallPromptStyle === "recall-heavy" || cfg.activeRecallPromptStyle === "precision-heavy" || cfg.activeRecallPromptStyle === "preference-only" ? cfg.activeRecallPromptStyle : "balanced",
|
|
616
|
+
activeRecallPromptOverride: typeof cfg.activeRecallPromptOverride === "string" && cfg.activeRecallPromptOverride.trim().length > 0 ? cfg.activeRecallPromptOverride.trim() : null,
|
|
617
|
+
activeRecallPromptAppend: typeof cfg.activeRecallPromptAppend === "string" && cfg.activeRecallPromptAppend.trim().length > 0 ? cfg.activeRecallPromptAppend.trim() : null,
|
|
618
|
+
activeRecallMaxSummaryChars: typeof cfg.activeRecallMaxSummaryChars === "number" ? Math.min(1e3, Math.max(40, Math.floor(cfg.activeRecallMaxSummaryChars))) : 220,
|
|
619
|
+
activeRecallRecentUserTurns: typeof cfg.activeRecallRecentUserTurns === "number" ? Math.min(4, Math.max(0, Math.floor(cfg.activeRecallRecentUserTurns))) : 2,
|
|
620
|
+
activeRecallRecentAssistantTurns: typeof cfg.activeRecallRecentAssistantTurns === "number" ? Math.min(3, Math.max(0, Math.floor(cfg.activeRecallRecentAssistantTurns))) : 1,
|
|
621
|
+
activeRecallRecentUserChars: typeof cfg.activeRecallRecentUserChars === "number" ? Math.min(1e3, Math.max(40, Math.floor(cfg.activeRecallRecentUserChars))) : 600,
|
|
622
|
+
activeRecallRecentAssistantChars: typeof cfg.activeRecallRecentAssistantChars === "number" ? Math.min(1e3, Math.max(40, Math.floor(cfg.activeRecallRecentAssistantChars))) : 400,
|
|
623
|
+
activeRecallThinking: cfg.activeRecallThinking === "low" || cfg.activeRecallThinking === "off" || cfg.activeRecallThinking === "minimal" || cfg.activeRecallThinking === "medium" || cfg.activeRecallThinking === "high" || cfg.activeRecallThinking === "xhigh" || cfg.activeRecallThinking === "adaptive" ? cfg.activeRecallThinking : "low",
|
|
624
|
+
activeRecallTimeoutMs: typeof cfg.activeRecallTimeoutMs === "number" ? Math.max(250, Math.floor(cfg.activeRecallTimeoutMs)) : 15e3,
|
|
625
|
+
activeRecallCacheTtlMs: typeof cfg.activeRecallCacheTtlMs === "number" ? cfg.activeRecallCacheTtlMs === 0 ? 0 : cfg.activeRecallCacheTtlMs < 0 ? 15e3 : Math.min(
|
|
626
|
+
12e4,
|
|
627
|
+
Math.max(1, Math.floor(cfg.activeRecallCacheTtlMs))
|
|
628
|
+
) : 15e3,
|
|
629
|
+
activeRecallModel: typeof cfg.activeRecallModel === "string" && cfg.activeRecallModel.trim().length > 0 ? cfg.activeRecallModel.trim() : null,
|
|
630
|
+
activeRecallModelFallbackPolicy: cfg.activeRecallModelFallbackPolicy === "resolved-only" ? "resolved-only" : "default-remote",
|
|
631
|
+
activeRecallPersistTranscripts: cfg.activeRecallPersistTranscripts === true,
|
|
632
|
+
activeRecallTranscriptDir: typeof cfg.activeRecallTranscriptDir === "string" && cfg.activeRecallTranscriptDir.trim().length > 0 ? cfg.activeRecallTranscriptDir.trim() : "active-recall",
|
|
633
|
+
activeRecallEntityGraphDepth: typeof cfg.activeRecallEntityGraphDepth === "number" ? Math.min(3, Math.max(0, Math.floor(cfg.activeRecallEntityGraphDepth))) : 1,
|
|
634
|
+
activeRecallIncludeCausalTrajectories: cfg.activeRecallIncludeCausalTrajectories === true,
|
|
635
|
+
activeRecallIncludeDaySummary: cfg.activeRecallIncludeDaySummary === true,
|
|
636
|
+
activeRecallAttachRecallExplain: cfg.activeRecallAttachRecallExplain === true,
|
|
637
|
+
activeRecallAllowChainedActiveMemory: cfg.activeRecallAllowChainedActiveMemory === true,
|
|
638
|
+
dreaming,
|
|
639
|
+
procedural,
|
|
640
|
+
heartbeat,
|
|
641
|
+
slotBehavior,
|
|
642
|
+
codexCompat,
|
|
435
643
|
// Hourly summaries
|
|
436
644
|
hourlySummariesEnabled: cfg.hourlySummariesEnabled !== false,
|
|
437
645
|
// default: true
|
|
@@ -498,7 +706,7 @@ function parseConfig(raw) {
|
|
|
498
706
|
semanticConsolidationMinClusterSize: typeof cfg.semanticConsolidationMinClusterSize === "number" ? Math.max(2, Math.floor(cfg.semanticConsolidationMinClusterSize)) : 3,
|
|
499
707
|
semanticConsolidationExcludeCategories: Array.isArray(cfg.semanticConsolidationExcludeCategories) ? cfg.semanticConsolidationExcludeCategories.filter(
|
|
500
708
|
(c) => typeof c === "string" && c.length > 0
|
|
501
|
-
) : ["correction", "commitment"],
|
|
709
|
+
) : ["correction", "commitment", "procedure"],
|
|
502
710
|
semanticConsolidationIntervalHours: typeof cfg.semanticConsolidationIntervalHours === "number" ? Math.max(1, Math.floor(cfg.semanticConsolidationIntervalHours)) : 168,
|
|
503
711
|
semanticConsolidationMaxPerRun: typeof cfg.semanticConsolidationMaxPerRun === "number" ? Math.max(0, Math.floor(cfg.semanticConsolidationMaxPerRun)) : 100,
|
|
504
712
|
creationMemoryEnabled: cfg.creationMemoryEnabled === true,
|
|
@@ -559,6 +767,25 @@ function parseConfig(raw) {
|
|
|
559
767
|
extractionMaxEntitiesPerRun: typeof cfg.extractionMaxEntitiesPerRun === "number" ? cfg.extractionMaxEntitiesPerRun : 6,
|
|
560
768
|
extractionMaxQuestionsPerRun: typeof cfg.extractionMaxQuestionsPerRun === "number" ? cfg.extractionMaxQuestionsPerRun : 3,
|
|
561
769
|
extractionMaxProfileUpdatesPerRun: typeof cfg.extractionMaxProfileUpdatesPerRun === "number" ? cfg.extractionMaxProfileUpdatesPerRun : 4,
|
|
770
|
+
// Importance write-gate for trivial extracted content (issue #372).
|
|
771
|
+
// Default "low" drops only "trivial" facts (greetings, single-word replies,
|
|
772
|
+
// heartbeat pings); set to "normal" or higher to make the gate stricter.
|
|
773
|
+
extractionMinImportanceLevel: (() => {
|
|
774
|
+
const raw2 = cfg.extractionMinImportanceLevel;
|
|
775
|
+
if (raw2 === "trivial" || raw2 === "low" || raw2 === "normal" || raw2 === "high" || raw2 === "critical") {
|
|
776
|
+
return raw2;
|
|
777
|
+
}
|
|
778
|
+
return "low";
|
|
779
|
+
})(),
|
|
780
|
+
// Extraction judge (issue #376). Opt-in LLM-as-judge fact-worthiness gate.
|
|
781
|
+
extractionJudgeEnabled: cfg.extractionJudgeEnabled === true,
|
|
782
|
+
extractionJudgeModel: typeof cfg.extractionJudgeModel === "string" ? cfg.extractionJudgeModel : "",
|
|
783
|
+
extractionJudgeBatchSize: typeof cfg.extractionJudgeBatchSize === "number" && Number.isFinite(cfg.extractionJudgeBatchSize) ? Math.max(1, Math.round(cfg.extractionJudgeBatchSize)) : 20,
|
|
784
|
+
extractionJudgeShadow: cfg.extractionJudgeShadow === true,
|
|
785
|
+
// Inline source attribution (issue #369). Opt-in to preserve
|
|
786
|
+
// backwards compatibility with existing downstream consumers.
|
|
787
|
+
inlineSourceAttributionEnabled: cfg.inlineSourceAttributionEnabled === true,
|
|
788
|
+
inlineSourceAttributionFormat: typeof cfg.inlineSourceAttributionFormat === "string" && cfg.inlineSourceAttributionFormat.trim().length > 0 ? cfg.inlineSourceAttributionFormat : "[Source: agent={agent}, session={sessionId}, ts={ts}]",
|
|
562
789
|
consolidationRequireNonZeroExtraction: cfg.consolidationRequireNonZeroExtraction !== false,
|
|
563
790
|
consolidationMinIntervalMs: typeof cfg.consolidationMinIntervalMs === "number" ? cfg.consolidationMinIntervalMs : 10 * 6e4,
|
|
564
791
|
// QMD maintenance (debounced singleflight)
|
|
@@ -578,6 +805,22 @@ function parseConfig(raw) {
|
|
|
578
805
|
localLlmFastModel: typeof cfg.localLlmFastModel === "string" && cfg.localLlmFastModel.length > 0 ? cfg.localLlmFastModel : "",
|
|
579
806
|
localLlmFastUrl: typeof cfg.localLlmFastUrl === "string" && cfg.localLlmFastUrl.length > 0 ? cfg.localLlmFastUrl : typeof cfg.localLlmUrl === "string" && cfg.localLlmUrl.length > 0 ? cfg.localLlmUrl : "http://localhost:1234/v1",
|
|
580
807
|
localLlmFastTimeoutMs: typeof cfg.localLlmFastTimeoutMs === "number" ? cfg.localLlmFastTimeoutMs : 15e3,
|
|
808
|
+
// Thinking-mode suppression on the main local LLM (issue #548).
|
|
809
|
+
// Default true — extraction / consolidation produce structured
|
|
810
|
+
// JSON and gain nothing from chain-of-thought; thinking-capable
|
|
811
|
+
// models burn their token budget on reasoning and blow the
|
|
812
|
+
// default 60s timeout. Operators who need thinking on the main
|
|
813
|
+
// client (e.g. for narrative tasks) can set this to false via
|
|
814
|
+
// config or --config CLI flag. The fast-tier `fastLlm` always
|
|
815
|
+
// disables thinking and is unaffected by this flag.
|
|
816
|
+
//
|
|
817
|
+
// Injection is backend-gated inside LocalLlmClient: the
|
|
818
|
+
// `chat_template_kwargs` field is only sent when the detected
|
|
819
|
+
// backend is in `THINKING_COMPATIBLE_BACKENDS` (LM Studio, vLLM).
|
|
820
|
+
// Strict OpenAI-compatible backends reject unknown request
|
|
821
|
+
// fields with 400, so the client fails open on unknown backends
|
|
822
|
+
// rather than tripping the 400 cooldown (Codex P1 on PR #550).
|
|
823
|
+
localLlmDisableThinking: coerceBool(cfg.localLlmDisableThinking) ?? true,
|
|
581
824
|
// Gateway config (passed from index.ts for fallback AI)
|
|
582
825
|
gatewayConfig: cfg.gatewayConfig,
|
|
583
826
|
// Gateway model source (v9.2) — route LLM calls through gateway agent model chain
|
|
@@ -661,11 +904,15 @@ function parseConfig(raw) {
|
|
|
661
904
|
entityRetrievalMaxSupportingFacts: typeof cfg.entityRetrievalMaxSupportingFacts === "number" ? cfg.entityRetrievalMaxSupportingFacts : 6,
|
|
662
905
|
entityRetrievalMaxRelatedEntities: typeof cfg.entityRetrievalMaxRelatedEntities === "number" ? cfg.entityRetrievalMaxRelatedEntities : 3,
|
|
663
906
|
entityRetrievalRecentTurns: typeof cfg.entityRetrievalRecentTurns === "number" ? cfg.entityRetrievalRecentTurns : 6,
|
|
907
|
+
entitySchemas,
|
|
664
908
|
recallBudgetChars: recallPipelineConfig.recallBudgetChars,
|
|
665
909
|
recallOuterTimeoutMs: typeof cfg.recallOuterTimeoutMs === "number" ? Math.max(0, Math.floor(cfg.recallOuterTimeoutMs)) : 75e3,
|
|
666
910
|
recallCoreDeadlineMs: typeof cfg.recallCoreDeadlineMs === "number" ? Math.max(0, Math.floor(cfg.recallCoreDeadlineMs)) : 75e3,
|
|
667
911
|
recallEnrichmentDeadlineMs: typeof cfg.recallEnrichmentDeadlineMs === "number" ? Math.max(0, Math.floor(cfg.recallEnrichmentDeadlineMs)) : 25e3,
|
|
668
912
|
recallPipeline: recallPipelineConfig.pipeline,
|
|
913
|
+
recallMmrEnabled: cfg.recallMmrEnabled !== false,
|
|
914
|
+
recallMmrLambda: typeof cfg.recallMmrLambda === "number" && Number.isFinite(cfg.recallMmrLambda) ? Math.min(1, Math.max(0, cfg.recallMmrLambda)) : 0.7,
|
|
915
|
+
recallMmrTopN: typeof cfg.recallMmrTopN === "number" && Number.isFinite(cfg.recallMmrTopN) ? Math.max(0, Math.floor(cfg.recallMmrTopN)) : 40,
|
|
669
916
|
qmdRecallCacheTtlMs: typeof cfg.qmdRecallCacheTtlMs === "number" ? Math.max(0, Math.floor(cfg.qmdRecallCacheTtlMs)) : 6e4,
|
|
670
917
|
qmdRecallCacheStaleTtlMs: typeof cfg.qmdRecallCacheStaleTtlMs === "number" ? Math.max(0, Math.floor(cfg.qmdRecallCacheStaleTtlMs)) : 10 * 6e4,
|
|
671
918
|
qmdRecallCacheMaxEntries: typeof cfg.qmdRecallCacheMaxEntries === "number" ? Math.max(0, Math.floor(cfg.qmdRecallCacheMaxEntries)) : 128,
|
|
@@ -674,6 +921,10 @@ function parseConfig(raw) {
|
|
|
674
921
|
entityActivityLogMaxEntries: typeof cfg.entityActivityLogMaxEntries === "number" ? cfg.entityActivityLogMaxEntries : 20,
|
|
675
922
|
entityAliasesEnabled: cfg.entityAliasesEnabled !== false,
|
|
676
923
|
entitySummaryEnabled: cfg.entitySummaryEnabled !== false,
|
|
924
|
+
entitySynthesisMaxTokens: typeof cfg.entitySynthesisMaxTokens === "number" && Number.isFinite(cfg.entitySynthesisMaxTokens) ? (() => {
|
|
925
|
+
const tokens = Math.max(0, Math.floor(cfg.entitySynthesisMaxTokens));
|
|
926
|
+
return tokens === 0 ? 0 : Math.max(10, tokens);
|
|
927
|
+
})() : 500,
|
|
677
928
|
// Search backend abstraction
|
|
678
929
|
searchBackend: ["qmd", "remote", "noop", "lancedb", "meilisearch", "orama"].includes(cfg.searchBackend) ? cfg.searchBackend : "qmd",
|
|
679
930
|
remoteSearchBaseUrl: typeof cfg.remoteSearchBaseUrl === "string" ? cfg.remoteSearchBaseUrl : void 0,
|
|
@@ -701,11 +952,27 @@ function parseConfig(raw) {
|
|
|
701
952
|
qmdExplainEnabled: cfg.qmdExplainEnabled === true,
|
|
702
953
|
// v6.0 Fact deduplication & archival
|
|
703
954
|
factDeduplicationEnabled: cfg.factDeduplicationEnabled !== false,
|
|
955
|
+
// Issue #373 — write-time semantic similarity guard
|
|
956
|
+
semanticDedupEnabled: cfg.semanticDedupEnabled !== false,
|
|
957
|
+
// Guard against NaN / Infinity — Number.isFinite rejects both and falls
|
|
958
|
+
// back to the documented default so the semantic dedup guard cannot be
|
|
959
|
+
// silently disabled by a malformed config value.
|
|
960
|
+
semanticDedupThreshold: typeof cfg.semanticDedupThreshold === "number" && Number.isFinite(cfg.semanticDedupThreshold) ? Math.min(1, Math.max(0, cfg.semanticDedupThreshold)) : 0.92,
|
|
961
|
+
// Zero is a valid "disable candidate lookup" signal and must be preserved.
|
|
962
|
+
// Only negative or non-finite values fall back to the default of 5.
|
|
963
|
+
// Fractional values in (0, 1) floor to 0, which would silently disable
|
|
964
|
+
// semantic dedup despite a clearly non-zero operator intent — clamp to 1.
|
|
965
|
+
semanticDedupCandidates: (() => {
|
|
966
|
+
const raw2 = cfg.semanticDedupCandidates;
|
|
967
|
+
if (typeof raw2 !== "number" || !Number.isFinite(raw2) || raw2 < 0) return 5;
|
|
968
|
+
const n = Math.floor(raw2);
|
|
969
|
+
return raw2 > 0 && n === 0 ? 1 : n;
|
|
970
|
+
})(),
|
|
704
971
|
factArchivalEnabled: cfg.factArchivalEnabled === true,
|
|
705
972
|
factArchivalAgeDays: typeof cfg.factArchivalAgeDays === "number" ? cfg.factArchivalAgeDays : 90,
|
|
706
973
|
factArchivalMaxImportance: typeof cfg.factArchivalMaxImportance === "number" ? cfg.factArchivalMaxImportance : 0.3,
|
|
707
974
|
factArchivalMaxAccessCount: typeof cfg.factArchivalMaxAccessCount === "number" ? cfg.factArchivalMaxAccessCount : 2,
|
|
708
|
-
factArchivalProtectedCategories: Array.isArray(cfg.factArchivalProtectedCategories) ? cfg.factArchivalProtectedCategories.filter((c) => typeof c === "string") : ["commitment", "preference", "decision", "principle"],
|
|
975
|
+
factArchivalProtectedCategories: Array.isArray(cfg.factArchivalProtectedCategories) ? cfg.factArchivalProtectedCategories.filter((c) => typeof c === "string") : ["commitment", "preference", "decision", "principle", "procedure"],
|
|
709
976
|
// v8.3 lifecycle policy engine (default off)
|
|
710
977
|
lifecyclePolicyEnabled: cfg.lifecyclePolicyEnabled === true,
|
|
711
978
|
lifecycleFilterStaleEnabled: cfg.lifecycleFilterStaleEnabled === true,
|
|
@@ -714,7 +981,7 @@ function parseConfig(raw) {
|
|
|
714
981
|
lifecycleArchiveDecayThreshold: typeof cfg.lifecycleArchiveDecayThreshold === "number" ? Math.min(1, Math.max(0, cfg.lifecycleArchiveDecayThreshold)) : 0.85,
|
|
715
982
|
lifecycleProtectedCategories: Array.isArray(cfg.lifecycleProtectedCategories) ? cfg.lifecycleProtectedCategories.filter(
|
|
716
983
|
(c) => typeof c === "string" && VALID_MEMORY_CATEGORIES.has(c)
|
|
717
|
-
) : ["decision", "principle", "commitment", "preference"],
|
|
984
|
+
) : ["decision", "principle", "commitment", "preference", "procedure"],
|
|
718
985
|
lifecycleMetricsEnabled: typeof cfg.lifecycleMetricsEnabled === "boolean" ? cfg.lifecycleMetricsEnabled : cfg.lifecyclePolicyEnabled === true,
|
|
719
986
|
// v8.3 proactive + policy learning (default off)
|
|
720
987
|
proactiveExtractionEnabled: cfg.proactiveExtractionEnabled === true,
|
|
@@ -858,7 +1125,71 @@ function parseConfig(raw) {
|
|
|
858
1125
|
temporal: typeof w?.temporal === "number" ? Math.max(0, w.temporal) : 0.85
|
|
859
1126
|
};
|
|
860
1127
|
})(),
|
|
861
|
-
parallelMaxResultsPerAgent: typeof cfg.parallelMaxResultsPerAgent === "number" ? Math.max(0, Math.floor(cfg.parallelMaxResultsPerAgent)) : 20
|
|
1128
|
+
parallelMaxResultsPerAgent: typeof cfg.parallelMaxResultsPerAgent === "number" ? Math.max(0, Math.floor(cfg.parallelMaxResultsPerAgent)) : 20,
|
|
1129
|
+
briefing: parseBriefingConfig(cfg.briefing),
|
|
1130
|
+
// Codex CLI connector settings (install-time)
|
|
1131
|
+
codex: (() => {
|
|
1132
|
+
const raw2 = cfg.codex && typeof cfg.codex === "object" && !Array.isArray(cfg.codex) ? cfg.codex : {};
|
|
1133
|
+
const installExtension = coerceInstallExtension(raw2.installExtension) ?? true;
|
|
1134
|
+
const codexHome = typeof raw2.codexHome === "string" && raw2.codexHome.trim().length > 0 ? raw2.codexHome.trim() : null;
|
|
1135
|
+
return { installExtension, codexHome };
|
|
1136
|
+
})(),
|
|
1137
|
+
// MECE Taxonomy (#366)
|
|
1138
|
+
// Coerce string booleans from CLI (e.g. --config taxonomyEnabled=true) — gotcha #36
|
|
1139
|
+
taxonomyEnabled: coerceBool(cfg.taxonomyEnabled) ?? false,
|
|
1140
|
+
taxonomyAutoGenResolver: coerceBool(cfg.taxonomyAutoGenResolver) ?? true,
|
|
1141
|
+
// Codex CLI — native memory materialization (#378)
|
|
1142
|
+
codexMaterializeMemories: cfg.codexMaterializeMemories !== false,
|
|
1143
|
+
codexMaterializeNamespace: typeof cfg.codexMaterializeNamespace === "string" && cfg.codexMaterializeNamespace.trim().length > 0 ? cfg.codexMaterializeNamespace.trim() : "auto",
|
|
1144
|
+
codexMaterializeMaxSummaryTokens: typeof cfg.codexMaterializeMaxSummaryTokens === "number" ? Math.max(0, Math.floor(cfg.codexMaterializeMaxSummaryTokens)) : 4500,
|
|
1145
|
+
codexMaterializeRolloutRetentionDays: typeof cfg.codexMaterializeRolloutRetentionDays === "number" ? Math.max(0, Math.floor(cfg.codexMaterializeRolloutRetentionDays)) : 30,
|
|
1146
|
+
codexMaterializeOnConsolidation: cfg.codexMaterializeOnConsolidation !== false,
|
|
1147
|
+
codexMaterializeOnSessionEnd: cfg.codexMaterializeOnSessionEnd !== false,
|
|
1148
|
+
// Codex CLI — marketplace integration (#418)
|
|
1149
|
+
codexMarketplaceEnabled: cfg.codexMarketplaceEnabled !== false,
|
|
1150
|
+
// default: true
|
|
1151
|
+
// Page-level versioning (issue #371)
|
|
1152
|
+
versioningEnabled: cfg.versioningEnabled === true,
|
|
1153
|
+
versioningMaxPerPage: typeof cfg.versioningMaxPerPage === "number" ? Math.max(0, Math.floor(cfg.versioningMaxPerPage)) : 50,
|
|
1154
|
+
versioningSidecarDir: typeof cfg.versioningSidecarDir === "string" && cfg.versioningSidecarDir.trim().length > 0 ? cfg.versioningSidecarDir.trim() : ".versions",
|
|
1155
|
+
// Binary file lifecycle management (#367)
|
|
1156
|
+
binaryLifecycleEnabled: cfg.binaryLifecycleEnabled === true,
|
|
1157
|
+
binaryLifecycleGracePeriodDays: typeof cfg.binaryLifecycleGracePeriodDays === "number" ? Math.max(0, Math.floor(cfg.binaryLifecycleGracePeriodDays)) : 7,
|
|
1158
|
+
binaryLifecycleBackendType: (() => {
|
|
1159
|
+
const valid = ["filesystem", "s3", "none"];
|
|
1160
|
+
const raw2 = cfg.binaryLifecycleBackendType;
|
|
1161
|
+
if (typeof raw2 === "string" && valid.includes(raw2)) {
|
|
1162
|
+
return raw2;
|
|
1163
|
+
}
|
|
1164
|
+
return "none";
|
|
1165
|
+
})(),
|
|
1166
|
+
binaryLifecycleBackendPath: typeof cfg.binaryLifecycleBackendPath === "string" ? cfg.binaryLifecycleBackendPath.trim() : "",
|
|
1167
|
+
// Codex citation parity (issue #379)
|
|
1168
|
+
citationsEnabled: cfg.citationsEnabled === true,
|
|
1169
|
+
citationsAutoDetect: cfg.citationsAutoDetect !== false,
|
|
1170
|
+
// External enrichment pipeline (issue #365)
|
|
1171
|
+
enrichmentEnabled: cfg.enrichmentEnabled === true,
|
|
1172
|
+
enrichmentAutoOnCreate: cfg.enrichmentAutoOnCreate === true,
|
|
1173
|
+
enrichmentMaxCandidatesPerEntity: typeof cfg.enrichmentMaxCandidatesPerEntity === "number" ? Math.max(0, Math.floor(cfg.enrichmentMaxCandidatesPerEntity)) : 20,
|
|
1174
|
+
// Memory extensions discovery (#382)
|
|
1175
|
+
memoryExtensionsEnabled: cfg.memoryExtensionsEnabled !== false,
|
|
1176
|
+
memoryExtensionsRoot: typeof cfg.memoryExtensionsRoot === "string" && cfg.memoryExtensionsRoot.trim().length > 0 ? cfg.memoryExtensionsRoot.trim() : ""
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
function parseBriefingConfig(raw) {
|
|
1180
|
+
const entry = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
1181
|
+
const defaultFormat = entry.defaultFormat === "json" || entry.defaultFormat === "markdown" ? entry.defaultFormat : "markdown";
|
|
1182
|
+
const maxFollowupsRaw = typeof entry.maxFollowups === "number" && Number.isFinite(entry.maxFollowups) ? Math.floor(entry.maxFollowups) : 5;
|
|
1183
|
+
const maxFollowups = Math.max(0, Math.min(10, maxFollowupsRaw));
|
|
1184
|
+
return {
|
|
1185
|
+
enabled: entry.enabled !== false,
|
|
1186
|
+
defaultWindow: typeof entry.defaultWindow === "string" && entry.defaultWindow.trim().length > 0 ? entry.defaultWindow.trim() : "yesterday",
|
|
1187
|
+
defaultFormat,
|
|
1188
|
+
maxFollowups,
|
|
1189
|
+
calendarSource: typeof entry.calendarSource === "string" && entry.calendarSource.trim().length > 0 ? entry.calendarSource.trim() : null,
|
|
1190
|
+
saveByDefault: entry.saveByDefault === true,
|
|
1191
|
+
saveDir: typeof entry.saveDir === "string" && entry.saveDir.trim().length > 0 ? entry.saveDir.trim() : null,
|
|
1192
|
+
llmFollowups: entry.llmFollowups !== false
|
|
862
1193
|
};
|
|
863
1194
|
}
|
|
864
1195
|
function clampNonNegativeNumber(value) {
|
|
@@ -922,6 +1253,11 @@ function buildDefaultRecallPipeline(cfg) {
|
|
|
922
1253
|
maxEntities: typeof cfg.knowledgeIndexMaxEntities === "number" ? Math.max(0, Math.floor(cfg.knowledgeIndexMaxEntities)) : 40
|
|
923
1254
|
},
|
|
924
1255
|
{ id: "verbatim-artifacts", enabled: cfg.verbatimArtifactsEnabled === true },
|
|
1256
|
+
{
|
|
1257
|
+
id: "procedure-recall",
|
|
1258
|
+
enabled: typeof cfg.procedural === "object" && cfg.procedural !== null && !Array.isArray(cfg.procedural) && cfg.procedural.enabled === true,
|
|
1259
|
+
maxChars: 2400
|
|
1260
|
+
},
|
|
925
1261
|
{ id: "memory-boxes", enabled: cfg.memoryBoxesEnabled === true },
|
|
926
1262
|
{ id: "temporal-memory-tree", enabled: cfg.temporalMemoryTreeEnabled === true },
|
|
927
1263
|
{ id: "lcm-compressed-history", enabled: cfg.lcmEnabled === true },
|
|
@@ -1021,7 +1357,8 @@ function buildRecallPipelineConfig(cfg) {
|
|
|
1021
1357
|
}
|
|
1022
1358
|
|
|
1023
1359
|
export {
|
|
1360
|
+
coerceInstallExtension,
|
|
1024
1361
|
VALID_MEMORY_CATEGORIES,
|
|
1025
1362
|
parseConfig
|
|
1026
1363
|
};
|
|
1027
|
-
//# sourceMappingURL=chunk-
|
|
1364
|
+
//# sourceMappingURL=chunk-MBJHSA7F.js.map
|