@remnic/core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (551) hide show
  1. package/dist/abstraction-nodes.d.ts +52 -0
  2. package/dist/abstraction-nodes.js +15 -0
  3. package/dist/abstraction-nodes.js.map +1 -0
  4. package/dist/access-cli.d.ts +5 -0
  5. package/dist/access-cli.js +308 -0
  6. package/dist/access-cli.js.map +1 -0
  7. package/dist/access-http.d.ts +158 -0
  8. package/dist/access-http.js +32 -0
  9. package/dist/access-http.js.map +1 -0
  10. package/dist/access-idempotency.d.ts +31 -0
  11. package/dist/access-idempotency.js +11 -0
  12. package/dist/access-idempotency.js.map +1 -0
  13. package/dist/access-mcp.d.ts +76 -0
  14. package/dist/access-mcp.js +8 -0
  15. package/dist/access-mcp.js.map +1 -0
  16. package/dist/access-schema.d.ts +266 -0
  17. package/dist/access-schema.js +29 -0
  18. package/dist/access-schema.js.map +1 -0
  19. package/dist/access-service.d.ts +614 -0
  20. package/dist/access-service.js +32 -0
  21. package/dist/access-service.js.map +1 -0
  22. package/dist/behavior-learner.d.ts +16 -0
  23. package/dist/behavior-learner.js +124 -0
  24. package/dist/behavior-learner.js.map +1 -0
  25. package/dist/behavior-signals.d.ts +15 -0
  26. package/dist/behavior-signals.js +11 -0
  27. package/dist/behavior-signals.js.map +1 -0
  28. package/dist/bootstrap.d.ts +46 -0
  29. package/dist/bootstrap.js +9 -0
  30. package/dist/bootstrap.js.map +1 -0
  31. package/dist/boxes.d.ts +93 -0
  32. package/dist/boxes.js +14 -0
  33. package/dist/boxes.js.map +1 -0
  34. package/dist/buffer.d.ts +22 -0
  35. package/dist/buffer.js +9 -0
  36. package/dist/buffer.js.map +1 -0
  37. package/dist/calibration.d.ts +81 -0
  38. package/dist/calibration.js +239 -0
  39. package/dist/calibration.js.map +1 -0
  40. package/dist/causal-behavior.d.ts +79 -0
  41. package/dist/causal-behavior.js +190 -0
  42. package/dist/causal-behavior.js.map +1 -0
  43. package/dist/causal-chain.d.ts +61 -0
  44. package/dist/causal-chain.js +24 -0
  45. package/dist/causal-chain.js.map +1 -0
  46. package/dist/causal-consolidation.d.ts +71 -0
  47. package/dist/causal-consolidation.js +211 -0
  48. package/dist/causal-consolidation.js.map +1 -0
  49. package/dist/causal-retrieval.d.ts +44 -0
  50. package/dist/causal-retrieval.js +184 -0
  51. package/dist/causal-retrieval.js.map +1 -0
  52. package/dist/causal-trajectory-graph.d.ts +13 -0
  53. package/dist/causal-trajectory-graph.js +59 -0
  54. package/dist/causal-trajectory-graph.js.map +1 -0
  55. package/dist/causal-trajectory.d.ts +68 -0
  56. package/dist/causal-trajectory.js +18 -0
  57. package/dist/causal-trajectory.js.map +1 -0
  58. package/dist/chunk-2CJCWDMR.js +87 -0
  59. package/dist/chunk-2CJCWDMR.js.map +1 -0
  60. package/dist/chunk-2NMMFZ5T.js +216 -0
  61. package/dist/chunk-2NMMFZ5T.js.map +1 -0
  62. package/dist/chunk-2PO5ZRKV.js +103 -0
  63. package/dist/chunk-2PO5ZRKV.js.map +1 -0
  64. package/dist/chunk-3QKK7QOS.js +154 -0
  65. package/dist/chunk-3QKK7QOS.js.map +1 -0
  66. package/dist/chunk-3SLRNYNG.js +26 -0
  67. package/dist/chunk-3SLRNYNG.js.map +1 -0
  68. package/dist/chunk-4A24LIM2.js +68 -0
  69. package/dist/chunk-4A24LIM2.js.map +1 -0
  70. package/dist/chunk-6HZ6AO2P.js +164 -0
  71. package/dist/chunk-6HZ6AO2P.js.map +1 -0
  72. package/dist/chunk-763GUIOU.js +302 -0
  73. package/dist/chunk-763GUIOU.js.map +1 -0
  74. package/dist/chunk-AAI7JARD.js +173 -0
  75. package/dist/chunk-AAI7JARD.js.map +1 -0
  76. package/dist/chunk-B7LOFDVE.js +112 -0
  77. package/dist/chunk-B7LOFDVE.js.map +1 -0
  78. package/dist/chunk-BDFZXRSO.js +318 -0
  79. package/dist/chunk-BDFZXRSO.js.map +1 -0
  80. package/dist/chunk-BOUYNNYD.js +707 -0
  81. package/dist/chunk-BOUYNNYD.js.map +1 -0
  82. package/dist/chunk-BRK4ODMI.js +60 -0
  83. package/dist/chunk-BRK4ODMI.js.map +1 -0
  84. package/dist/chunk-C6QPK5GG.js +111 -0
  85. package/dist/chunk-C6QPK5GG.js.map +1 -0
  86. package/dist/chunk-C7VW7C3F.js +117 -0
  87. package/dist/chunk-C7VW7C3F.js.map +1 -0
  88. package/dist/chunk-CDW777AI.js +621 -0
  89. package/dist/chunk-CDW777AI.js.map +1 -0
  90. package/dist/chunk-CULXMQJH.js +185 -0
  91. package/dist/chunk-CULXMQJH.js.map +1 -0
  92. package/dist/chunk-CXWFUJR2.js +1203 -0
  93. package/dist/chunk-CXWFUJR2.js.map +1 -0
  94. package/dist/chunk-DGXUHMOV.js +61 -0
  95. package/dist/chunk-DGXUHMOV.js.map +1 -0
  96. package/dist/chunk-DM2T26WE.js +61 -0
  97. package/dist/chunk-DM2T26WE.js.map +1 -0
  98. package/dist/chunk-DORBM6OB.js +81 -0
  99. package/dist/chunk-DORBM6OB.js.map +1 -0
  100. package/dist/chunk-DT5TVLJE.js +32 -0
  101. package/dist/chunk-DT5TVLJE.js.map +1 -0
  102. package/dist/chunk-EEQLFRUM.js +89 -0
  103. package/dist/chunk-EEQLFRUM.js.map +1 -0
  104. package/dist/chunk-EQINRHYR.js +672 -0
  105. package/dist/chunk-EQINRHYR.js.map +1 -0
  106. package/dist/chunk-ESSMF2FR.js +146 -0
  107. package/dist/chunk-ESSMF2FR.js.map +1 -0
  108. package/dist/chunk-ETOW6ACV.js +158 -0
  109. package/dist/chunk-ETOW6ACV.js.map +1 -0
  110. package/dist/chunk-FYIYMQ5N.js +221 -0
  111. package/dist/chunk-FYIYMQ5N.js.map +1 -0
  112. package/dist/chunk-G3AG3KZN.js +78 -0
  113. package/dist/chunk-G3AG3KZN.js.map +1 -0
  114. package/dist/chunk-GJR6D6KC.js +61 -0
  115. package/dist/chunk-GJR6D6KC.js.map +1 -0
  116. package/dist/chunk-GPGBSNKM.js +380 -0
  117. package/dist/chunk-GPGBSNKM.js.map +1 -0
  118. package/dist/chunk-H63EDPFJ.js +57 -0
  119. package/dist/chunk-H63EDPFJ.js.map +1 -0
  120. package/dist/chunk-HG2NKWR2.js +185 -0
  121. package/dist/chunk-HG2NKWR2.js.map +1 -0
  122. package/dist/chunk-HL4DB7TO.js +13 -0
  123. package/dist/chunk-HL4DB7TO.js.map +1 -0
  124. package/dist/chunk-HLBYLYRD.js +346 -0
  125. package/dist/chunk-HLBYLYRD.js.map +1 -0
  126. package/dist/chunk-HLXVTBF3.js +109 -0
  127. package/dist/chunk-HLXVTBF3.js.map +1 -0
  128. package/dist/chunk-IFFFR3MR.js +68 -0
  129. package/dist/chunk-IFFFR3MR.js.map +1 -0
  130. package/dist/chunk-ISY75RLM.js +1027 -0
  131. package/dist/chunk-ISY75RLM.js.map +1 -0
  132. package/dist/chunk-IZME7KW2.js +1886 -0
  133. package/dist/chunk-IZME7KW2.js.map +1 -0
  134. package/dist/chunk-J3BT33K7.js +720 -0
  135. package/dist/chunk-J3BT33K7.js.map +1 -0
  136. package/dist/chunk-J47FNDR7.js +113 -0
  137. package/dist/chunk-J47FNDR7.js.map +1 -0
  138. package/dist/chunk-JWPLJLDU.js +63 -0
  139. package/dist/chunk-JWPLJLDU.js.map +1 -0
  140. package/dist/chunk-K6WK37A6.js +865 -0
  141. package/dist/chunk-K6WK37A6.js.map +1 -0
  142. package/dist/chunk-KL4CP4SB.js +130 -0
  143. package/dist/chunk-KL4CP4SB.js.map +1 -0
  144. package/dist/chunk-KT4NEUNF.js +315 -0
  145. package/dist/chunk-KT4NEUNF.js.map +1 -0
  146. package/dist/chunk-KWBU5S5U.js +42 -0
  147. package/dist/chunk-KWBU5S5U.js.map +1 -0
  148. package/dist/chunk-L5RPWGFK.js +59 -0
  149. package/dist/chunk-L5RPWGFK.js.map +1 -0
  150. package/dist/chunk-L7WO3MZ4.js +128 -0
  151. package/dist/chunk-L7WO3MZ4.js.map +1 -0
  152. package/dist/chunk-LIRZNNUP.js +74 -0
  153. package/dist/chunk-LIRZNNUP.js.map +1 -0
  154. package/dist/chunk-LK6SGL53.js +22 -0
  155. package/dist/chunk-LK6SGL53.js.map +1 -0
  156. package/dist/chunk-LOBRX7VD.js +200 -0
  157. package/dist/chunk-LOBRX7VD.js.map +1 -0
  158. package/dist/chunk-LPSF4OQH.js +47 -0
  159. package/dist/chunk-LPSF4OQH.js.map +1 -0
  160. package/dist/chunk-LU3GQNDQ.js +152 -0
  161. package/dist/chunk-LU3GQNDQ.js.map +1 -0
  162. package/dist/chunk-M5KEYE5E.js +350 -0
  163. package/dist/chunk-M5KEYE5E.js.map +1 -0
  164. package/dist/chunk-M62O4P4T.js +41 -0
  165. package/dist/chunk-M62O4P4T.js.map +1 -0
  166. package/dist/chunk-MARWOCVP.js +48 -0
  167. package/dist/chunk-MARWOCVP.js.map +1 -0
  168. package/dist/chunk-MDDAA2AO.js +925 -0
  169. package/dist/chunk-MDDAA2AO.js.map +1 -0
  170. package/dist/chunk-MWGVGUIS.js +198 -0
  171. package/dist/chunk-MWGVGUIS.js.map +1 -0
  172. package/dist/chunk-N5AKDXAI.js +74 -0
  173. package/dist/chunk-N5AKDXAI.js.map +1 -0
  174. package/dist/chunk-NGAVDO7E.js +115 -0
  175. package/dist/chunk-NGAVDO7E.js.map +1 -0
  176. package/dist/chunk-NTTLPF7F.js +283 -0
  177. package/dist/chunk-NTTLPF7F.js.map +1 -0
  178. package/dist/chunk-ONRU4L2N.js +240 -0
  179. package/dist/chunk-ONRU4L2N.js.map +1 -0
  180. package/dist/chunk-ORZMT74A.js +209 -0
  181. package/dist/chunk-ORZMT74A.js.map +1 -0
  182. package/dist/chunk-OTAVQCSF.js +268 -0
  183. package/dist/chunk-OTAVQCSF.js.map +1 -0
  184. package/dist/chunk-PGK3VUHN.js +160 -0
  185. package/dist/chunk-PGK3VUHN.js.map +1 -0
  186. package/dist/chunk-Q6FETXJA.js +1362 -0
  187. package/dist/chunk-Q6FETXJA.js.map +1 -0
  188. package/dist/chunk-QANCTXQF.js +271 -0
  189. package/dist/chunk-QANCTXQF.js.map +1 -0
  190. package/dist/chunk-QCCCQT3O.js +189 -0
  191. package/dist/chunk-QCCCQT3O.js.map +1 -0
  192. package/dist/chunk-QDOSNLB4.js +1048 -0
  193. package/dist/chunk-QDOSNLB4.js.map +1 -0
  194. package/dist/chunk-QFQVZOGA.js +2168 -0
  195. package/dist/chunk-QFQVZOGA.js.map +1 -0
  196. package/dist/chunk-QPKFPHOO.js +178 -0
  197. package/dist/chunk-QPKFPHOO.js.map +1 -0
  198. package/dist/chunk-QSVPYQPG.js +268 -0
  199. package/dist/chunk-QSVPYQPG.js.map +1 -0
  200. package/dist/chunk-QWUUMMIK.js +3045 -0
  201. package/dist/chunk-QWUUMMIK.js.map +1 -0
  202. package/dist/chunk-QY2BHY5O.js +2378 -0
  203. package/dist/chunk-QY2BHY5O.js.map +1 -0
  204. package/dist/chunk-SCHEKPYH.js +349 -0
  205. package/dist/chunk-SCHEKPYH.js.map +1 -0
  206. package/dist/chunk-SCU65EZI.js +15 -0
  207. package/dist/chunk-SCU65EZI.js.map +1 -0
  208. package/dist/chunk-T4WRIV2C.js +170 -0
  209. package/dist/chunk-T4WRIV2C.js.map +1 -0
  210. package/dist/chunk-TKO4HZCK.js +1852 -0
  211. package/dist/chunk-TKO4HZCK.js.map +1 -0
  212. package/dist/chunk-TP4FZJIZ.js +93 -0
  213. package/dist/chunk-TP4FZJIZ.js.map +1 -0
  214. package/dist/chunk-TPB3I2AC.js +403 -0
  215. package/dist/chunk-TPB3I2AC.js.map +1 -0
  216. package/dist/chunk-TVVVQQAK.js +1431 -0
  217. package/dist/chunk-TVVVQQAK.js.map +1 -0
  218. package/dist/chunk-U4PV25RD.js +14 -0
  219. package/dist/chunk-U4PV25RD.js.map +1 -0
  220. package/dist/chunk-UCYSTFZR.js +284 -0
  221. package/dist/chunk-UCYSTFZR.js.map +1 -0
  222. package/dist/chunk-UHGBNIOS.js +205 -0
  223. package/dist/chunk-UHGBNIOS.js.map +1 -0
  224. package/dist/chunk-UIYZ5T3I.js +108 -0
  225. package/dist/chunk-UIYZ5T3I.js.map +1 -0
  226. package/dist/chunk-UV2FO7J4.js +747 -0
  227. package/dist/chunk-UV2FO7J4.js.map +1 -0
  228. package/dist/chunk-UZB5KHKX.js +63 -0
  229. package/dist/chunk-UZB5KHKX.js.map +1 -0
  230. package/dist/chunk-V3RXWQIE.js +626 -0
  231. package/dist/chunk-V3RXWQIE.js.map +1 -0
  232. package/dist/chunk-V4YC4LUK.js +444 -0
  233. package/dist/chunk-V4YC4LUK.js.map +1 -0
  234. package/dist/chunk-VEWZZM3H.js +133 -0
  235. package/dist/chunk-VEWZZM3H.js.map +1 -0
  236. package/dist/chunk-WWIQTB2Y.js +98 -0
  237. package/dist/chunk-WWIQTB2Y.js.map +1 -0
  238. package/dist/chunk-X7XN6YU4.js +24 -0
  239. package/dist/chunk-X7XN6YU4.js.map +1 -0
  240. package/dist/chunk-XKECPATV.js +202 -0
  241. package/dist/chunk-XKECPATV.js.map +1 -0
  242. package/dist/chunk-XYIK4LF6.js +75 -0
  243. package/dist/chunk-XYIK4LF6.js.map +1 -0
  244. package/dist/chunk-Y27UJK6V.js +39 -0
  245. package/dist/chunk-Y27UJK6V.js.map +1 -0
  246. package/dist/chunk-Y4Z4I6WK.js +9 -0
  247. package/dist/chunk-Y4Z4I6WK.js.map +1 -0
  248. package/dist/chunk-YAPUAHAY.js +10761 -0
  249. package/dist/chunk-YAPUAHAY.js.map +1 -0
  250. package/dist/chunk-YAZNBMNF.js +92 -0
  251. package/dist/chunk-YAZNBMNF.js.map +1 -0
  252. package/dist/chunk-YCN4BVDK.js +66 -0
  253. package/dist/chunk-YCN4BVDK.js.map +1 -0
  254. package/dist/chunk-YNCQ7E4M.js +388 -0
  255. package/dist/chunk-YNCQ7E4M.js.map +1 -0
  256. package/dist/chunk-YNI4S5WT.js +143 -0
  257. package/dist/chunk-YNI4S5WT.js.map +1 -0
  258. package/dist/chunk-YRMVARQP.js +406 -0
  259. package/dist/chunk-YRMVARQP.js.map +1 -0
  260. package/dist/chunk-Z5AAYHUC.js +79 -0
  261. package/dist/chunk-Z5AAYHUC.js.map +1 -0
  262. package/dist/chunk-Z5LAYHGJ.js +15 -0
  263. package/dist/chunk-Z5LAYHGJ.js.map +1 -0
  264. package/dist/chunk-ZJLY4QSU.js +823 -0
  265. package/dist/chunk-ZJLY4QSU.js.map +1 -0
  266. package/dist/chunk-ZKYI7UVO.js +276 -0
  267. package/dist/chunk-ZKYI7UVO.js.map +1 -0
  268. package/dist/chunk-ZPKBYX2F.js +297 -0
  269. package/dist/chunk-ZPKBYX2F.js.map +1 -0
  270. package/dist/chunking.d.ts +48 -0
  271. package/dist/chunking.js +11 -0
  272. package/dist/chunking.js.map +1 -0
  273. package/dist/cli.d.ts +1162 -0
  274. package/dist/cli.js +7187 -0
  275. package/dist/cli.js.map +1 -0
  276. package/dist/commitment-ledger.d.ts +83 -0
  277. package/dist/commitment-ledger.js +19 -0
  278. package/dist/commitment-ledger.js.map +1 -0
  279. package/dist/compression-optimizer.d.ts +37 -0
  280. package/dist/compression-optimizer.js +13 -0
  281. package/dist/compression-optimizer.js.map +1 -0
  282. package/dist/config.d.ts +6 -0
  283. package/dist/config.js +12 -0
  284. package/dist/config.js.map +1 -0
  285. package/dist/cue-anchors.d.ts +50 -0
  286. package/dist/cue-anchors.js +15 -0
  287. package/dist/cue-anchors.js.map +1 -0
  288. package/dist/dashboard-runtime.d.ts +46 -0
  289. package/dist/dashboard-runtime.js +10 -0
  290. package/dist/dashboard-runtime.js.map +1 -0
  291. package/dist/day-summary.d.ts +6 -0
  292. package/dist/day-summary.js +10 -0
  293. package/dist/day-summary.js.map +1 -0
  294. package/dist/delinearize.d.ts +34 -0
  295. package/dist/delinearize.js +11 -0
  296. package/dist/delinearize.js.map +1 -0
  297. package/dist/embedding-fallback.d.ts +22 -0
  298. package/dist/embedding-fallback.js +8 -0
  299. package/dist/embedding-fallback.js.map +1 -0
  300. package/dist/engine-P26JFSVY.js +19 -0
  301. package/dist/engine-P26JFSVY.js.map +1 -0
  302. package/dist/entity-retrieval.d.ts +23 -0
  303. package/dist/entity-retrieval.js +24 -0
  304. package/dist/entity-retrieval.js.map +1 -0
  305. package/dist/evals.d.ts +282 -0
  306. package/dist/evals.js +32 -0
  307. package/dist/evals.js.map +1 -0
  308. package/dist/explicit-capture.d.ts +60 -0
  309. package/dist/explicit-capture.js +23 -0
  310. package/dist/explicit-capture.js.map +1 -0
  311. package/dist/extraction.d.ts +141 -0
  312. package/dist/extraction.js +22 -0
  313. package/dist/extraction.js.map +1 -0
  314. package/dist/fallback-llm.d.ts +95 -0
  315. package/dist/fallback-llm.js +12 -0
  316. package/dist/fallback-llm.js.map +1 -0
  317. package/dist/graph-dashboard-diff.d.ts +12 -0
  318. package/dist/graph-dashboard-diff.js +8 -0
  319. package/dist/graph-dashboard-diff.js.map +1 -0
  320. package/dist/graph-dashboard-key.d.ts +5 -0
  321. package/dist/graph-dashboard-key.js +7 -0
  322. package/dist/graph-dashboard-key.js.map +1 -0
  323. package/dist/graph-dashboard-parser.d.ts +20 -0
  324. package/dist/graph-dashboard-parser.js +8 -0
  325. package/dist/graph-dashboard-parser.js.map +1 -0
  326. package/dist/graph.d.ts +157 -0
  327. package/dist/graph.js +27 -0
  328. package/dist/graph.js.map +1 -0
  329. package/dist/harmonic-retrieval.d.ts +27 -0
  330. package/dist/harmonic-retrieval.js +12 -0
  331. package/dist/harmonic-retrieval.js.map +1 -0
  332. package/dist/himem.d.ts +23 -0
  333. package/dist/himem.js +7 -0
  334. package/dist/himem.js.map +1 -0
  335. package/dist/hygiene.d.ts +24 -0
  336. package/dist/hygiene.js +9 -0
  337. package/dist/hygiene.js.map +1 -0
  338. package/dist/identity-continuity.d.ts +17 -0
  339. package/dist/identity-continuity.js +19 -0
  340. package/dist/identity-continuity.js.map +1 -0
  341. package/dist/importance.d.ts +25 -0
  342. package/dist/importance.js +11 -0
  343. package/dist/importance.js.map +1 -0
  344. package/dist/index.d.ts +923 -0
  345. package/dist/index.js +2512 -0
  346. package/dist/index.js.map +1 -0
  347. package/dist/intent.d.ts +8 -0
  348. package/dist/intent.js +13 -0
  349. package/dist/intent.js.map +1 -0
  350. package/dist/json-extract.d.ts +14 -0
  351. package/dist/json-extract.js +9 -0
  352. package/dist/json-extract.js.map +1 -0
  353. package/dist/json-store.d.ts +5 -0
  354. package/dist/json-store.js +11 -0
  355. package/dist/json-store.js.map +1 -0
  356. package/dist/legacy-hook-compat.d.ts +3 -0
  357. package/dist/legacy-hook-compat.js +35 -0
  358. package/dist/legacy-hook-compat.js.map +1 -0
  359. package/dist/lifecycle.d.ts +52 -0
  360. package/dist/lifecycle.js +21 -0
  361. package/dist/lifecycle.js.map +1 -0
  362. package/dist/local-llm.d.ts +154 -0
  363. package/dist/local-llm.js +10 -0
  364. package/dist/local-llm.js.map +1 -0
  365. package/dist/logger.d.ts +15 -0
  366. package/dist/logger.js +9 -0
  367. package/dist/logger.js.map +1 -0
  368. package/dist/memory-action-policy.d.ts +13 -0
  369. package/dist/memory-action-policy.js +7 -0
  370. package/dist/memory-action-policy.js.map +1 -0
  371. package/dist/memory-cache.d.ts +35 -0
  372. package/dist/memory-cache.js +37 -0
  373. package/dist/memory-cache.js.map +1 -0
  374. package/dist/memory-lifecycle-ledger-utils.d.ts +13 -0
  375. package/dist/memory-lifecycle-ledger-utils.js +23 -0
  376. package/dist/memory-lifecycle-ledger-utils.js.map +1 -0
  377. package/dist/memory-projection-format.d.ts +4 -0
  378. package/dist/memory-projection-format.js +9 -0
  379. package/dist/memory-projection-format.js.map +1 -0
  380. package/dist/memory-projection-store-NxMkbocT.d.ts +221 -0
  381. package/dist/memory-projection-store.d.ts +3 -0
  382. package/dist/memory-projection-store.js +31 -0
  383. package/dist/memory-projection-store.js.map +1 -0
  384. package/dist/model-registry.d.ts +60 -0
  385. package/dist/model-registry.js +8 -0
  386. package/dist/model-registry.js.map +1 -0
  387. package/dist/native-knowledge.d.ts +94 -0
  388. package/dist/native-knowledge.js +26 -0
  389. package/dist/native-knowledge.js.map +1 -0
  390. package/dist/negative.d.ts +26 -0
  391. package/dist/negative.js +8 -0
  392. package/dist/negative.js.map +1 -0
  393. package/dist/objective-state-writers.d.ts +22 -0
  394. package/dist/objective-state-writers.js +313 -0
  395. package/dist/objective-state-writers.js.map +1 -0
  396. package/dist/objective-state.d.ts +75 -0
  397. package/dist/objective-state.js +17 -0
  398. package/dist/objective-state.js.map +1 -0
  399. package/dist/openai-chat-compat.d.ts +13 -0
  400. package/dist/openai-chat-compat.js +11 -0
  401. package/dist/openai-chat-compat.js.map +1 -0
  402. package/dist/operator-toolkit.d.ts +304 -0
  403. package/dist/operator-toolkit.js +41 -0
  404. package/dist/operator-toolkit.js.map +1 -0
  405. package/dist/opik-exporter.d.ts +72 -0
  406. package/dist/opik-exporter.js +361 -0
  407. package/dist/opik-exporter.js.map +1 -0
  408. package/dist/orchestrator-zTa-Qo-1.d.ts +1104 -0
  409. package/dist/orchestrator.d.ts +21 -0
  410. package/dist/orchestrator.js +145 -0
  411. package/dist/orchestrator.js.map +1 -0
  412. package/dist/policy-runtime.d.ts +37 -0
  413. package/dist/policy-runtime.js +13 -0
  414. package/dist/policy-runtime.js.map +1 -0
  415. package/dist/port-C1GZFv8h.d.ts +41 -0
  416. package/dist/profiling.d.ts +80 -0
  417. package/dist/profiling.js +10 -0
  418. package/dist/profiling.js.map +1 -0
  419. package/dist/qmd-recall-cache.d.ts +29 -0
  420. package/dist/qmd-recall-cache.js +13 -0
  421. package/dist/qmd-recall-cache.js.map +1 -0
  422. package/dist/qmd.d.ts +105 -0
  423. package/dist/qmd.js +13 -0
  424. package/dist/qmd.js.map +1 -0
  425. package/dist/recall-qos.d.ts +33 -0
  426. package/dist/recall-qos.js +10 -0
  427. package/dist/recall-qos.js.map +1 -0
  428. package/dist/recall-query-policy.d.ts +20 -0
  429. package/dist/recall-query-policy.js +11 -0
  430. package/dist/recall-query-policy.js.map +1 -0
  431. package/dist/recall-state.d.ts +113 -0
  432. package/dist/recall-state.js +12 -0
  433. package/dist/recall-state.js.map +1 -0
  434. package/dist/recall-tokenization.d.ts +4 -0
  435. package/dist/recall-tokenization.js +9 -0
  436. package/dist/recall-tokenization.js.map +1 -0
  437. package/dist/reconstruct.d.ts +16 -0
  438. package/dist/reconstruct.js +7 -0
  439. package/dist/reconstruct.js.map +1 -0
  440. package/dist/release-changelog.d.ts +7 -0
  441. package/dist/release-changelog.js +30 -0
  442. package/dist/release-changelog.js.map +1 -0
  443. package/dist/relevance.d.ts +18 -0
  444. package/dist/relevance.js +8 -0
  445. package/dist/relevance.js.map +1 -0
  446. package/dist/rerank.d.ts +57 -0
  447. package/dist/rerank.js +11 -0
  448. package/dist/rerank.js.map +1 -0
  449. package/dist/resolve-provider-secret.d.ts +16 -0
  450. package/dist/resolve-provider-secret.js +11 -0
  451. package/dist/resolve-provider-secret.js.map +1 -0
  452. package/dist/resume-bundles.d.ts +66 -0
  453. package/dist/resume-bundles.js +27 -0
  454. package/dist/resume-bundles.js.map +1 -0
  455. package/dist/retrieval-agents.d.ts +129 -0
  456. package/dist/retrieval-agents.js +23 -0
  457. package/dist/retrieval-agents.js.map +1 -0
  458. package/dist/retrieval.d.ts +19 -0
  459. package/dist/retrieval.js +10 -0
  460. package/dist/retrieval.js.map +1 -0
  461. package/dist/sanitize.d.ts +9 -0
  462. package/dist/sanitize.js +9 -0
  463. package/dist/sanitize.js.map +1 -0
  464. package/dist/schemas.d.ts +688 -0
  465. package/dist/schemas.js +51 -0
  466. package/dist/schemas.js.map +1 -0
  467. package/dist/sdk-compat.d.ts +21 -0
  468. package/dist/sdk-compat.js +28 -0
  469. package/dist/sdk-compat.js.map +1 -0
  470. package/dist/semantic-consolidation.d.ts +42 -0
  471. package/dist/semantic-consolidation.js +12 -0
  472. package/dist/semantic-consolidation.js.map +1 -0
  473. package/dist/semantic-rule-promotion.d.ts +28 -0
  474. package/dist/semantic-rule-promotion.js +17 -0
  475. package/dist/semantic-rule-promotion.js.map +1 -0
  476. package/dist/semantic-rule-verifier.d.ts +19 -0
  477. package/dist/semantic-rule-verifier.js +18 -0
  478. package/dist/semantic-rule-verifier.js.map +1 -0
  479. package/dist/session-integrity.d.ts +67 -0
  480. package/dist/session-integrity.js +11 -0
  481. package/dist/session-integrity.js.map +1 -0
  482. package/dist/session-observer-bands.d.ts +6 -0
  483. package/dist/session-observer-bands.js +9 -0
  484. package/dist/session-observer-bands.js.map +1 -0
  485. package/dist/session-observer-state.d.ts +40 -0
  486. package/dist/session-observer-state.js +11 -0
  487. package/dist/session-observer-state.js.map +1 -0
  488. package/dist/signal.d.ts +6 -0
  489. package/dist/signal.js +9 -0
  490. package/dist/signal.js.map +1 -0
  491. package/dist/storage.d.ts +453 -0
  492. package/dist/storage.js +24 -0
  493. package/dist/storage.js.map +1 -0
  494. package/dist/store-contract.d.ts +10 -0
  495. package/dist/store-contract.js +21 -0
  496. package/dist/store-contract.js.map +1 -0
  497. package/dist/summarizer.d.ts +35 -0
  498. package/dist/summarizer.js +17 -0
  499. package/dist/summarizer.js.map +1 -0
  500. package/dist/summary-snapshot.d.ts +8 -0
  501. package/dist/summary-snapshot.js +13 -0
  502. package/dist/summary-snapshot.js.map +1 -0
  503. package/dist/temporal-index.d.ts +139 -0
  504. package/dist/temporal-index.js +29 -0
  505. package/dist/temporal-index.js.map +1 -0
  506. package/dist/threading.d.ts +62 -0
  507. package/dist/threading.js +8 -0
  508. package/dist/threading.js.map +1 -0
  509. package/dist/tier-migration.d.ts +44 -0
  510. package/dist/tier-migration.js +7 -0
  511. package/dist/tier-migration.js.map +1 -0
  512. package/dist/tier-routing.d.ts +21 -0
  513. package/dist/tier-routing.js +10 -0
  514. package/dist/tier-routing.js.map +1 -0
  515. package/dist/tmt.d.ts +79 -0
  516. package/dist/tmt.js +29 -0
  517. package/dist/tmt.js.map +1 -0
  518. package/dist/tokens.d.ts +24 -0
  519. package/dist/tokens.js +21 -0
  520. package/dist/tokens.js.map +1 -0
  521. package/dist/topics.d.ts +29 -0
  522. package/dist/topics.js +9 -0
  523. package/dist/topics.js.map +1 -0
  524. package/dist/transcript.d.ts +171 -0
  525. package/dist/transcript.js +9 -0
  526. package/dist/transcript.js.map +1 -0
  527. package/dist/trust-zones.d.ts +170 -0
  528. package/dist/trust-zones.js +32 -0
  529. package/dist/trust-zones.js.map +1 -0
  530. package/dist/types.d.ts +1243 -0
  531. package/dist/types.js +9 -0
  532. package/dist/types.js.map +1 -0
  533. package/dist/utility-learner.d.ts +59 -0
  534. package/dist/utility-learner.js +17 -0
  535. package/dist/utility-learner.js.map +1 -0
  536. package/dist/utility-runtime.d.ts +21 -0
  537. package/dist/utility-runtime.js +16 -0
  538. package/dist/utility-runtime.js.map +1 -0
  539. package/dist/utility-telemetry.d.ts +68 -0
  540. package/dist/utility-telemetry.js +17 -0
  541. package/dist/utility-telemetry.js.map +1 -0
  542. package/dist/verified-recall.d.ts +17 -0
  543. package/dist/verified-recall.js +19 -0
  544. package/dist/verified-recall.js.map +1 -0
  545. package/dist/version-utils.d.ts +4 -0
  546. package/dist/version-utils.js +7 -0
  547. package/dist/version-utils.js.map +1 -0
  548. package/dist/work-product-ledger.d.ts +65 -0
  549. package/dist/work-product-ledger.js +18 -0
  550. package/dist/work-product-ledger.js.map +1 -0
  551. package/package.json +58 -0
@@ -0,0 +1,1027 @@
1
+ import {
2
+ cloneDefaultSessionObserverBands
3
+ } from "./chunk-Z5LAYHGJ.js";
4
+ import {
5
+ readEnvVar,
6
+ resolveHomeDir
7
+ } from "./chunk-MARWOCVP.js";
8
+ import {
9
+ log
10
+ } from "./chunk-KWBU5S5U.js";
11
+
12
+ // src/config.ts
13
+ import path from "path";
14
+ var DEFAULT_MEMORY_DIR = path.join(
15
+ resolveHomeDir(),
16
+ ".openclaw",
17
+ "workspace",
18
+ "memory",
19
+ "local"
20
+ );
21
+ var DEFAULT_WORKSPACE_DIR = path.join(
22
+ resolveHomeDir(),
23
+ ".openclaw",
24
+ "workspace"
25
+ );
26
+ function resolveEnvVars(value) {
27
+ const resolved = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, envVar) => {
28
+ const envValue = readEnvVar(envVar);
29
+ if (!envValue) {
30
+ throw new Error(`Environment variable ${envVar} is not set`);
31
+ }
32
+ return envValue;
33
+ });
34
+ const remaining = resolved.match(/\$\{[^}]*\}/);
35
+ if (remaining) {
36
+ throw new Error(`Malformed environment variable placeholder: ${remaining[0]}`);
37
+ }
38
+ return resolved;
39
+ }
40
+ function normalizeOpenaiBaseUrl(value, source) {
41
+ if (!value) return void 0;
42
+ const trimmed = value.trim();
43
+ if (trimmed.length === 0) return void 0;
44
+ let parsed;
45
+ try {
46
+ parsed = new URL(trimmed);
47
+ } catch {
48
+ log.warn(`ignoring invalid openaiBaseUrl from ${source}: not a valid URL`);
49
+ return void 0;
50
+ }
51
+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
52
+ log.warn(
53
+ `ignoring openaiBaseUrl from ${source}: unsupported URL scheme (${parsed.protocol.replace(":", "")})`
54
+ );
55
+ return void 0;
56
+ }
57
+ if (parsed.protocol === "http:") {
58
+ log.warn(`openaiBaseUrl from ${source} is using insecure http; prefer https`);
59
+ }
60
+ let url = parsed.toString();
61
+ while (url.endsWith("/")) url = url.slice(0, -1);
62
+ return url;
63
+ }
64
+ function normalizeMemoryRelativeDir(raw, fallback) {
65
+ if (typeof raw !== "string") return fallback;
66
+ const trimmed = raw.trim();
67
+ if (trimmed.length === 0) return fallback;
68
+ const normalized = trimmed.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0 && segment !== "." && segment !== "..").join("/");
69
+ return normalized.length > 0 ? normalized : fallback;
70
+ }
71
+ var VALID_EFFORTS = ["none", "low", "medium", "high"];
72
+ var VALID_TRIGGERS = ["smart", "every_n", "time_based"];
73
+ var VALID_IDENTITY_INJECTION_MODES = ["recovery_only", "minimal", "full"];
74
+ var VALID_MEMORY_OS_PRESETS = [
75
+ "conservative",
76
+ "balanced",
77
+ "research-max",
78
+ "local-llm-heavy"
79
+ ];
80
+ var VALID_MEMORY_CATEGORIES = /* @__PURE__ */ new Set([
81
+ "fact",
82
+ "preference",
83
+ "correction",
84
+ "entity",
85
+ "decision",
86
+ "relationship",
87
+ "principle",
88
+ "commitment",
89
+ "moment",
90
+ "skill",
91
+ "rule"
92
+ ]);
93
+ var DEFAULT_BEHAVIOR_LOOP_PROTECTED_PARAMS = [
94
+ "maxMemoryTokens",
95
+ "qmdMaxResults",
96
+ "qmdColdMaxResults",
97
+ "recallPlannerMaxQmdResultsMinimal",
98
+ "verbatimArtifactsMaxRecall"
99
+ ];
100
+ var MEMORY_OS_PRESET_ALIASES = {
101
+ research: "research-max"
102
+ };
103
+ var MEMORY_OS_PRESETS = {
104
+ conservative: {
105
+ maxMemoryTokens: 1500,
106
+ recallPlannerMaxQmdResultsMinimal: 2,
107
+ recallPlannerMaxQmdResultsFull: 5,
108
+ queryAwareIndexingEnabled: false,
109
+ verbatimArtifactsEnabled: false,
110
+ verbatimArtifactsMaxRecall: 2,
111
+ rerankEnabled: false,
112
+ localLlmEnabled: false,
113
+ localLlmFastEnabled: false,
114
+ multiGraphMemoryEnabled: false,
115
+ graphRecallEnabled: false,
116
+ graphAssistInFullModeEnabled: false,
117
+ proactiveExtractionEnabled: false,
118
+ contextCompressionActionsEnabled: false,
119
+ compressionGuidelineLearningEnabled: false,
120
+ compressionGuidelineSemanticRefinementEnabled: false,
121
+ maxProactiveQuestionsPerExtraction: 0,
122
+ maxCompressionTokensPerHour: 0,
123
+ behaviorLoopAutoTuneEnabled: false
124
+ },
125
+ balanced: {
126
+ maxMemoryTokens: 2e3,
127
+ recallPlannerMaxQmdResultsMinimal: 4,
128
+ recallPlannerMaxQmdResultsFull: 8,
129
+ queryAwareIndexingEnabled: true,
130
+ verbatimArtifactsEnabled: true,
131
+ verbatimArtifactsMaxRecall: 4,
132
+ rerankEnabled: true,
133
+ rerankProvider: "local",
134
+ localLlmEnabled: false,
135
+ localLlmFastEnabled: false,
136
+ multiGraphMemoryEnabled: false,
137
+ graphRecallEnabled: false,
138
+ graphAssistInFullModeEnabled: false,
139
+ proactiveExtractionEnabled: false,
140
+ contextCompressionActionsEnabled: false,
141
+ compressionGuidelineLearningEnabled: false,
142
+ compressionGuidelineSemanticRefinementEnabled: false,
143
+ maxProactiveQuestionsPerExtraction: 2,
144
+ maxCompressionTokensPerHour: 1500,
145
+ behaviorLoopAutoTuneEnabled: false
146
+ },
147
+ "research-max": {
148
+ maxMemoryTokens: 3200,
149
+ recallPlannerMaxQmdResultsMinimal: 6,
150
+ recallPlannerMaxQmdResultsFull: 12,
151
+ queryAwareIndexingEnabled: true,
152
+ verbatimArtifactsEnabled: true,
153
+ verbatimArtifactsMaxRecall: 6,
154
+ rerankEnabled: true,
155
+ rerankProvider: "local",
156
+ localLlmEnabled: false,
157
+ localLlmFastEnabled: false,
158
+ multiGraphMemoryEnabled: true,
159
+ graphRecallEnabled: true,
160
+ graphAssistInFullModeEnabled: true,
161
+ proactiveExtractionEnabled: true,
162
+ contextCompressionActionsEnabled: true,
163
+ compressionGuidelineLearningEnabled: true,
164
+ compressionGuidelineSemanticRefinementEnabled: true,
165
+ maxProactiveQuestionsPerExtraction: 4,
166
+ maxCompressionTokensPerHour: 3e3,
167
+ behaviorLoopAutoTuneEnabled: true
168
+ },
169
+ "local-llm-heavy": {
170
+ maxMemoryTokens: 2400,
171
+ recallPlannerMaxQmdResultsMinimal: 4,
172
+ recallPlannerMaxQmdResultsFull: 8,
173
+ queryAwareIndexingEnabled: true,
174
+ verbatimArtifactsEnabled: true,
175
+ verbatimArtifactsMaxRecall: 4,
176
+ rerankEnabled: true,
177
+ rerankProvider: "local",
178
+ localLlmEnabled: true,
179
+ localLlmFastEnabled: true,
180
+ embeddingFallbackProvider: "local",
181
+ localLlmFallback: true,
182
+ multiGraphMemoryEnabled: false,
183
+ graphRecallEnabled: false,
184
+ graphAssistInFullModeEnabled: false,
185
+ proactiveExtractionEnabled: true,
186
+ contextCompressionActionsEnabled: true,
187
+ compressionGuidelineLearningEnabled: true,
188
+ compressionGuidelineSemanticRefinementEnabled: false,
189
+ maxProactiveQuestionsPerExtraction: 2,
190
+ maxCompressionTokensPerHour: 1500,
191
+ behaviorLoopAutoTuneEnabled: false
192
+ }
193
+ };
194
+ function resolveMemoryOsPreset(value) {
195
+ if (typeof value !== "string") return void 0;
196
+ const normalized = value.trim();
197
+ if (VALID_MEMORY_OS_PRESETS.includes(normalized)) {
198
+ return normalized;
199
+ }
200
+ return MEMORY_OS_PRESET_ALIASES[normalized];
201
+ }
202
+ function parseConfig(raw) {
203
+ const baseCfg = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
204
+ const memoryOsPreset = resolveMemoryOsPreset(baseCfg.memoryOsPreset);
205
+ const cfg = memoryOsPreset ? {
206
+ ...MEMORY_OS_PRESETS[memoryOsPreset],
207
+ ...baseCfg,
208
+ memoryOsPreset
209
+ } : baseCfg;
210
+ let apiKey;
211
+ if (typeof cfg.openaiApiKey === "string" && cfg.openaiApiKey.length > 0) {
212
+ apiKey = resolveEnvVars(cfg.openaiApiKey);
213
+ } else {
214
+ apiKey = process.env.OPENAI_API_KEY;
215
+ }
216
+ const model = typeof cfg.model === "string" && cfg.model.length > 0 ? cfg.model : "gpt-5.2";
217
+ const captureMode = cfg.captureMode === "explicit" || cfg.captureMode === "hybrid" ? cfg.captureMode : "implicit";
218
+ const rawEffort = cfg.reasoningEffort;
219
+ const reasoningEffort = rawEffort && VALID_EFFORTS.includes(rawEffort) ? rawEffort : "low";
220
+ const rawTrigger = cfg.triggerMode;
221
+ const triggerMode = rawTrigger && VALID_TRIGGERS.includes(rawTrigger) ? rawTrigger : "smart";
222
+ const memoryDir = typeof cfg.memoryDir === "string" && cfg.memoryDir.length > 0 ? cfg.memoryDir : DEFAULT_MEMORY_DIR;
223
+ const rawIdentityInjectionMode = cfg.identityInjectionMode;
224
+ const identityInjectionMode = rawIdentityInjectionMode && VALID_IDENTITY_INJECTION_MODES.includes(rawIdentityInjectionMode) ? rawIdentityInjectionMode : "recovery_only";
225
+ const identityContinuityEnabled = cfg.identityContinuityEnabled === true;
226
+ const sessionObserverBands = Array.isArray(cfg.sessionObserverBands) ? cfg.sessionObserverBands.map((band) => ({
227
+ maxBytes: typeof band?.maxBytes === "number" ? Math.max(0, Math.floor(band.maxBytes)) : 0,
228
+ triggerDeltaBytes: typeof band?.triggerDeltaBytes === "number" ? Math.max(0, Math.floor(band.triggerDeltaBytes)) : 0,
229
+ triggerDeltaTokens: typeof band?.triggerDeltaTokens === "number" ? Math.max(0, Math.floor(band.triggerDeltaTokens)) : 0
230
+ })).filter((band) => band.maxBytes > 0) : cloneDefaultSessionObserverBands();
231
+ const principalRules = Array.isArray(cfg.principalFromSessionKeyRules) ? cfg.principalFromSessionKeyRules.map((r) => ({
232
+ match: typeof r?.match === "string" ? r.match : "",
233
+ principal: typeof r?.principal === "string" ? r.principal : ""
234
+ })).filter((r) => r.match.length > 0 && r.principal.length > 0) : [];
235
+ const rawHygiene = cfg.fileHygiene && typeof cfg.fileHygiene === "object" && !Array.isArray(cfg.fileHygiene) ? cfg.fileHygiene : void 0;
236
+ const hygieneEnabled = rawHygiene?.enabled === true;
237
+ const fileHygiene = hygieneEnabled ? {
238
+ enabled: true,
239
+ lintEnabled: rawHygiene?.lintEnabled !== false,
240
+ lintBudgetBytes: typeof rawHygiene?.lintBudgetBytes === "number" ? rawHygiene.lintBudgetBytes : 2e4,
241
+ lintWarnRatio: typeof rawHygiene?.lintWarnRatio === "number" ? rawHygiene.lintWarnRatio : 0.8,
242
+ lintPaths: Array.isArray(rawHygiene?.lintPaths) ? rawHygiene.lintPaths : ["IDENTITY.md", "MEMORY.md"],
243
+ rotateEnabled: rawHygiene?.rotateEnabled === true,
244
+ rotateMaxBytes: typeof rawHygiene?.rotateMaxBytes === "number" ? rawHygiene.rotateMaxBytes : 18e3,
245
+ rotateKeepTailChars: typeof rawHygiene?.rotateKeepTailChars === "number" ? rawHygiene.rotateKeepTailChars : 2e3,
246
+ rotatePaths: Array.isArray(rawHygiene?.rotatePaths) ? rawHygiene.rotatePaths : ["IDENTITY.md"],
247
+ archiveDir: typeof rawHygiene?.archiveDir === "string" && rawHygiene.archiveDir.length > 0 ? rawHygiene.archiveDir : ".engram-archive",
248
+ runMinIntervalMs: typeof rawHygiene?.runMinIntervalMs === "number" ? rawHygiene.runMinIntervalMs : 5 * 60 * 1e3,
249
+ warningsLogEnabled: rawHygiene?.warningsLogEnabled === true,
250
+ warningsLogPath: typeof rawHygiene?.warningsLogPath === "string" && rawHygiene.warningsLogPath.length > 0 ? rawHygiene.warningsLogPath : "hygiene/warnings.md",
251
+ indexEnabled: rawHygiene?.indexEnabled === true,
252
+ indexPath: typeof rawHygiene?.indexPath === "string" && rawHygiene.indexPath.length > 0 ? rawHygiene.indexPath : "ENGRAM_INDEX.md"
253
+ } : void 0;
254
+ const rawNativeKnowledge = cfg.nativeKnowledge && typeof cfg.nativeKnowledge === "object" && !Array.isArray(cfg.nativeKnowledge) ? cfg.nativeKnowledge : void 0;
255
+ const nativeKnowledge = rawNativeKnowledge?.enabled === true ? {
256
+ enabled: true,
257
+ includeFiles: Array.isArray(rawNativeKnowledge.includeFiles) ? rawNativeKnowledge.includeFiles.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : ["IDENTITY.md", "MEMORY.md"],
258
+ maxChunkChars: typeof rawNativeKnowledge.maxChunkChars === "number" ? Math.max(200, Math.floor(rawNativeKnowledge.maxChunkChars)) : 900,
259
+ maxResults: typeof rawNativeKnowledge.maxResults === "number" ? Math.max(0, Math.floor(rawNativeKnowledge.maxResults)) : 4,
260
+ maxChars: typeof rawNativeKnowledge.maxChars === "number" ? Math.max(0, Math.floor(rawNativeKnowledge.maxChars)) : 2400,
261
+ stateDir: normalizeMemoryRelativeDir(rawNativeKnowledge.stateDir, "state/native-knowledge"),
262
+ openclawWorkspace: rawNativeKnowledge.openclawWorkspace && typeof rawNativeKnowledge.openclawWorkspace === "object" && !Array.isArray(rawNativeKnowledge.openclawWorkspace) && rawNativeKnowledge.openclawWorkspace.enabled === true ? {
263
+ enabled: true,
264
+ bootstrapFiles: Array.isArray(rawNativeKnowledge.openclawWorkspace.bootstrapFiles) ? rawNativeKnowledge.openclawWorkspace.bootstrapFiles.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : ["IDENTITY.md", "MEMORY.md", "USER.md"],
265
+ handoffGlobs: Array.isArray(rawNativeKnowledge.openclawWorkspace.handoffGlobs) ? rawNativeKnowledge.openclawWorkspace.handoffGlobs.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : ["**/*handoff*.md", "handoffs/**/*.md"],
266
+ dailySummaryGlobs: Array.isArray(rawNativeKnowledge.openclawWorkspace.dailySummaryGlobs) ? rawNativeKnowledge.openclawWorkspace.dailySummaryGlobs.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : ["**/*daily*summary*.md", "summaries/**/*.md"],
267
+ automationNoteGlobs: Array.isArray(rawNativeKnowledge.openclawWorkspace.automationNoteGlobs) ? rawNativeKnowledge.openclawWorkspace.automationNoteGlobs.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : [],
268
+ workspaceDocGlobs: Array.isArray(rawNativeKnowledge.openclawWorkspace.workspaceDocGlobs) ? rawNativeKnowledge.openclawWorkspace.workspaceDocGlobs.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : [],
269
+ excludeGlobs: [
270
+ ".git/**",
271
+ "node_modules/**",
272
+ "dist/**",
273
+ "build/**",
274
+ "coverage/**",
275
+ "**/*.log",
276
+ "**/.env*",
277
+ "**/*.pem",
278
+ "**/*.key",
279
+ ...Array.isArray(rawNativeKnowledge.openclawWorkspace.excludeGlobs) ? rawNativeKnowledge.openclawWorkspace.excludeGlobs.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : []
280
+ ].filter((value, index, array) => array.indexOf(value) === index),
281
+ sharedSafeGlobs: Array.isArray(rawNativeKnowledge.openclawWorkspace.sharedSafeGlobs) ? rawNativeKnowledge.openclawWorkspace.sharedSafeGlobs.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : []
282
+ } : void 0,
283
+ obsidianVaults: Array.isArray(rawNativeKnowledge.obsidianVaults) ? rawNativeKnowledge.obsidianVaults.filter((value) => !!value && typeof value === "object" && !Array.isArray(value)).map((vault, index) => {
284
+ const defaultId = `vault-${index + 1}`;
285
+ return {
286
+ id: typeof vault.id === "string" && vault.id.trim().length > 0 ? vault.id.trim() : defaultId,
287
+ rootDir: typeof vault.rootDir === "string" && vault.rootDir.trim().length > 0 ? vault.rootDir.trim() : "",
288
+ includeGlobs: Array.isArray(vault.includeGlobs) ? vault.includeGlobs.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : ["**/*.md"],
289
+ excludeGlobs: Array.isArray(vault.excludeGlobs) ? vault.excludeGlobs.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : [".obsidian/**", "**/*.canvas", "**/*.png", "**/*.jpg", "**/*.jpeg", "**/*.gif", "**/*.pdf"],
290
+ namespace: typeof vault.namespace === "string" && vault.namespace.trim().length > 0 ? vault.namespace.trim() : void 0,
291
+ privacyClass: typeof vault.privacyClass === "string" && vault.privacyClass.trim().length > 0 ? vault.privacyClass.trim() : void 0,
292
+ folderRules: Array.isArray(vault.folderRules) ? vault.folderRules.filter((value) => !!value && typeof value === "object" && !Array.isArray(value)).map((rule) => ({
293
+ pathPrefix: typeof rule.pathPrefix === "string" && rule.pathPrefix.trim().length > 0 ? rule.pathPrefix.trim() : "",
294
+ namespace: typeof rule.namespace === "string" && rule.namespace.trim().length > 0 ? rule.namespace.trim() : void 0,
295
+ privacyClass: typeof rule.privacyClass === "string" && rule.privacyClass.trim().length > 0 ? rule.privacyClass.trim() : void 0
296
+ })).filter((rule) => rule.pathPrefix.length > 0) : [],
297
+ dailyNotePatterns: Array.isArray(vault.dailyNotePatterns) ? vault.dailyNotePatterns.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : ["YYYY-MM-DD"],
298
+ materializeBacklinks: vault.materializeBacklinks === true
299
+ };
300
+ }).filter((vault) => vault.rootDir.length > 0) : []
301
+ } : void 0;
302
+ const rawAgentAccessHttp = cfg.agentAccessHttp && typeof cfg.agentAccessHttp === "object" && !Array.isArray(cfg.agentAccessHttp) ? cfg.agentAccessHttp : void 0;
303
+ const agentAccessHttp = {
304
+ enabled: rawAgentAccessHttp?.enabled === true,
305
+ host: typeof rawAgentAccessHttp?.host === "string" && rawAgentAccessHttp.host.trim().length > 0 ? rawAgentAccessHttp.host.trim() : "127.0.0.1",
306
+ port: typeof rawAgentAccessHttp?.port === "number" ? Math.max(0, Math.floor(rawAgentAccessHttp.port)) : 4318,
307
+ authToken: typeof rawAgentAccessHttp?.authToken === "string" && rawAgentAccessHttp.authToken.trim().length > 0 ? resolveEnvVars(rawAgentAccessHttp.authToken) : process.env.OPENCLAW_REMNIC_ACCESS_TOKEN ?? process.env.OPENCLAW_ENGRAM_ACCESS_TOKEN,
308
+ principal: typeof rawAgentAccessHttp?.principal === "string" && rawAgentAccessHttp.principal.trim().length > 0 ? resolveEnvVars(rawAgentAccessHttp.principal) : process.env.OPENCLAW_ENGRAM_ACCESS_PRINCIPAL?.trim() || void 0,
309
+ maxBodyBytes: typeof rawAgentAccessHttp?.maxBodyBytes === "number" ? Math.max(1, Math.floor(rawAgentAccessHttp.maxBodyBytes)) : 131072
310
+ };
311
+ let baseUrl;
312
+ if (typeof cfg.openaiBaseUrl === "string" && cfg.openaiBaseUrl.length > 0) {
313
+ baseUrl = normalizeOpenaiBaseUrl(resolveEnvVars(cfg.openaiBaseUrl), "config");
314
+ } else {
315
+ baseUrl = normalizeOpenaiBaseUrl(process.env.OPENAI_BASE_URL, "env");
316
+ }
317
+ const sharedCrossSignalSemanticEnabled = cfg.sharedCrossSignalSemanticEnabled === true || cfg.crossSignalsSemanticEnabled === true;
318
+ const sharedCrossSignalSemanticTimeoutMs = typeof cfg.sharedCrossSignalSemanticTimeoutMs === "number" ? Math.max(1, Math.floor(cfg.sharedCrossSignalSemanticTimeoutMs)) : typeof cfg.crossSignalsSemanticTimeoutMs === "number" ? Math.max(1, Math.floor(cfg.crossSignalsSemanticTimeoutMs)) : 4e3;
319
+ const recallPipelineConfig = buildRecallPipelineConfig(cfg);
320
+ return {
321
+ openaiApiKey: apiKey,
322
+ openaiBaseUrl: baseUrl,
323
+ model,
324
+ reasoningEffort,
325
+ triggerMode,
326
+ bufferMaxTurns: typeof cfg.bufferMaxTurns === "number" ? cfg.bufferMaxTurns : 5,
327
+ bufferMaxMinutes: typeof cfg.bufferMaxMinutes === "number" ? cfg.bufferMaxMinutes : 15,
328
+ consolidateEveryN: typeof cfg.consolidateEveryN === "number" ? cfg.consolidateEveryN : 3,
329
+ highSignalPatterns: Array.isArray(cfg.highSignalPatterns) ? cfg.highSignalPatterns : [],
330
+ maxMemoryTokens: typeof cfg.maxMemoryTokens === "number" ? cfg.maxMemoryTokens : 2e3,
331
+ memoryOsPreset,
332
+ qmdEnabled: cfg.qmdEnabled !== false,
333
+ qmdCollection: typeof cfg.qmdCollection === "string" ? cfg.qmdCollection : "openclaw-engram",
334
+ qmdMaxResults: typeof cfg.qmdMaxResults === "number" ? cfg.qmdMaxResults : 8,
335
+ qmdColdTierEnabled: cfg.qmdColdTierEnabled === true,
336
+ qmdColdCollection: typeof cfg.qmdColdCollection === "string" && cfg.qmdColdCollection.length > 0 ? cfg.qmdColdCollection : "openclaw-engram-cold",
337
+ qmdColdMaxResults: typeof cfg.qmdColdMaxResults === "number" ? cfg.qmdColdMaxResults : 8,
338
+ qmdTierMigrationEnabled: cfg.qmdTierMigrationEnabled === true,
339
+ qmdTierDemotionMinAgeDays: typeof cfg.qmdTierDemotionMinAgeDays === "number" ? Math.max(0, Math.floor(cfg.qmdTierDemotionMinAgeDays)) : 14,
340
+ qmdTierDemotionValueThreshold: typeof cfg.qmdTierDemotionValueThreshold === "number" ? Math.max(0, Math.min(1, cfg.qmdTierDemotionValueThreshold)) : 0.35,
341
+ qmdTierPromotionValueThreshold: typeof cfg.qmdTierPromotionValueThreshold === "number" ? Math.max(0, Math.min(1, cfg.qmdTierPromotionValueThreshold)) : 0.7,
342
+ qmdTierParityGraphEnabled: cfg.qmdTierParityGraphEnabled !== false,
343
+ qmdTierParityHiMemEnabled: cfg.qmdTierParityHiMemEnabled !== false,
344
+ qmdTierAutoBackfillEnabled: cfg.qmdTierAutoBackfillEnabled === true,
345
+ embeddingFallbackEnabled: cfg.embeddingFallbackEnabled !== false,
346
+ embeddingFallbackProvider: cfg.embeddingFallbackProvider === "openai" ? "openai" : cfg.embeddingFallbackProvider === "local" ? "local" : "auto",
347
+ qmdPath: typeof cfg.qmdPath === "string" && cfg.qmdPath.length > 0 ? cfg.qmdPath : void 0,
348
+ memoryDir,
349
+ debug: cfg.debug === true,
350
+ identityEnabled: cfg.identityEnabled !== false,
351
+ identityContinuityEnabled,
352
+ identityInjectionMode,
353
+ identityMaxInjectChars: typeof cfg.identityMaxInjectChars === "number" ? Math.max(0, Math.floor(cfg.identityMaxInjectChars)) : 1200,
354
+ continuityIncidentLoggingEnabled: typeof cfg.continuityIncidentLoggingEnabled === "boolean" ? cfg.continuityIncidentLoggingEnabled : identityContinuityEnabled,
355
+ continuityAuditEnabled: cfg.continuityAuditEnabled === true,
356
+ sessionObserverEnabled: cfg.sessionObserverEnabled === true,
357
+ sessionObserverDebounceMs: typeof cfg.sessionObserverDebounceMs === "number" ? Math.max(0, Math.floor(cfg.sessionObserverDebounceMs)) : 12e4,
358
+ sessionObserverBands,
359
+ injectQuestions: cfg.injectQuestions === true,
360
+ commitmentDecayDays: typeof cfg.commitmentDecayDays === "number" ? cfg.commitmentDecayDays : 90,
361
+ workspaceDir: typeof cfg.workspaceDir === "string" && cfg.workspaceDir.length > 0 ? cfg.workspaceDir : DEFAULT_WORKSPACE_DIR,
362
+ captureMode,
363
+ fileHygiene,
364
+ nativeKnowledge,
365
+ agentAccessHttp,
366
+ // Access tracking (Phase 1A)
367
+ accessTrackingEnabled: cfg.accessTrackingEnabled !== false,
368
+ accessTrackingBufferMaxSize: typeof cfg.accessTrackingBufferMaxSize === "number" ? cfg.accessTrackingBufferMaxSize : 100,
369
+ // Retrieval options
370
+ recencyWeight: typeof cfg.recencyWeight === "number" ? cfg.recencyWeight : 0.2,
371
+ boostAccessCount: cfg.boostAccessCount !== false,
372
+ recordEmptyRecallImpressions: cfg.recordEmptyRecallImpressions === true,
373
+ // v2.2 Advanced Retrieval (safe defaults: off unless enabled)
374
+ queryExpansionEnabled: cfg.queryExpansionEnabled === true,
375
+ queryExpansionMaxQueries: typeof cfg.queryExpansionMaxQueries === "number" ? cfg.queryExpansionMaxQueries : 4,
376
+ queryExpansionMinTokenLen: typeof cfg.queryExpansionMinTokenLen === "number" ? cfg.queryExpansionMinTokenLen : 3,
377
+ rerankEnabled: cfg.rerankEnabled === true,
378
+ rerankProvider: cfg.rerankProvider === "cloud" ? "cloud" : "local",
379
+ rerankMaxCandidates: typeof cfg.rerankMaxCandidates === "number" ? cfg.rerankMaxCandidates : 20,
380
+ rerankTimeoutMs: typeof cfg.rerankTimeoutMs === "number" ? cfg.rerankTimeoutMs : 8e3,
381
+ rerankCacheEnabled: cfg.rerankCacheEnabled !== false,
382
+ rerankCacheTtlMs: typeof cfg.rerankCacheTtlMs === "number" ? cfg.rerankCacheTtlMs : 60 * 60 * 1e3,
383
+ feedbackEnabled: cfg.feedbackEnabled === true,
384
+ // v2.2 Negative Examples (safe defaults: off unless enabled)
385
+ negativeExamplesEnabled: cfg.negativeExamplesEnabled === true,
386
+ negativeExamplesPenaltyPerHit: typeof cfg.negativeExamplesPenaltyPerHit === "number" ? cfg.negativeExamplesPenaltyPerHit : 0.05,
387
+ negativeExamplesPenaltyCap: typeof cfg.negativeExamplesPenaltyCap === "number" ? cfg.negativeExamplesPenaltyCap : 0.25,
388
+ // Chunking (Phase 2A)
389
+ chunkingEnabled: cfg.chunkingEnabled === true,
390
+ // Off by default initially
391
+ chunkingTargetTokens: typeof cfg.chunkingTargetTokens === "number" ? cfg.chunkingTargetTokens : 200,
392
+ chunkingMinTokens: typeof cfg.chunkingMinTokens === "number" ? cfg.chunkingMinTokens : 150,
393
+ chunkingOverlapSentences: typeof cfg.chunkingOverlapSentences === "number" ? cfg.chunkingOverlapSentences : 2,
394
+ // Contradiction Detection (Phase 2B)
395
+ contradictionDetectionEnabled: cfg.contradictionDetectionEnabled === true,
396
+ // Off by default initially
397
+ contradictionSimilarityThreshold: typeof cfg.contradictionSimilarityThreshold === "number" ? cfg.contradictionSimilarityThreshold : 0.7,
398
+ contradictionMinConfidence: typeof cfg.contradictionMinConfidence === "number" ? cfg.contradictionMinConfidence : 0.9,
399
+ contradictionAutoResolve: cfg.contradictionAutoResolve !== false,
400
+ // Memory Linking (Phase 3A)
401
+ memoryLinkingEnabled: cfg.memoryLinkingEnabled === true,
402
+ // Off by default initially
403
+ // Conversation Threading (Phase 3B)
404
+ threadingEnabled: cfg.threadingEnabled === true,
405
+ // Off by default initially
406
+ threadingGapMinutes: typeof cfg.threadingGapMinutes === "number" ? cfg.threadingGapMinutes : 30,
407
+ // Memory Summarization (Phase 4A)
408
+ summarizationEnabled: cfg.summarizationEnabled === true,
409
+ // Off by default
410
+ summarizationTriggerCount: typeof cfg.summarizationTriggerCount === "number" ? cfg.summarizationTriggerCount : 1e3,
411
+ summarizationRecentToKeep: typeof cfg.summarizationRecentToKeep === "number" ? cfg.summarizationRecentToKeep : 300,
412
+ summarizationImportanceThreshold: typeof cfg.summarizationImportanceThreshold === "number" ? cfg.summarizationImportanceThreshold : 0.3,
413
+ summarizationProtectedTags: Array.isArray(cfg.summarizationProtectedTags) ? cfg.summarizationProtectedTags : ["commitment", "preference", "decision", "principle"],
414
+ // Topic Extraction (Phase 4B)
415
+ topicExtractionEnabled: cfg.topicExtractionEnabled !== false,
416
+ // On by default
417
+ topicExtractionTopN: typeof cfg.topicExtractionTopN === "number" ? cfg.topicExtractionTopN : 50,
418
+ // Transcript & Context Preservation (v2.0)
419
+ // Transcript archive
420
+ transcriptEnabled: cfg.transcriptEnabled !== false,
421
+ // default: true
422
+ transcriptRetentionDays: typeof cfg.transcriptRetentionDays === "number" ? cfg.transcriptRetentionDays : 7,
423
+ transcriptSkipChannelTypes: Array.isArray(cfg.transcriptSkipChannelTypes) ? cfg.transcriptSkipChannelTypes : ["cron"],
424
+ // default: skip cron transcripts
425
+ // Transcript injection
426
+ transcriptRecallHours: typeof cfg.transcriptRecallHours === "number" ? cfg.transcriptRecallHours : 12,
427
+ maxTranscriptTurns: typeof cfg.maxTranscriptTurns === "number" ? cfg.maxTranscriptTurns : 50,
428
+ maxTranscriptTokens: typeof cfg.maxTranscriptTokens === "number" ? cfg.maxTranscriptTokens : 1e3,
429
+ // Checkpoint
430
+ checkpointEnabled: cfg.checkpointEnabled !== false,
431
+ // default: true
432
+ checkpointTurns: typeof cfg.checkpointTurns === "number" ? cfg.checkpointTurns : 15,
433
+ // Compaction reset (opt-in, default: false)
434
+ compactionResetEnabled: cfg.compactionResetEnabled === true,
435
+ // Hourly summaries
436
+ hourlySummariesEnabled: cfg.hourlySummariesEnabled !== false,
437
+ // default: true
438
+ daySummaryEnabled: cfg.daySummaryEnabled !== false,
439
+ // default: true
440
+ hourlySummaryCronAutoRegister: cfg.hourlySummaryCronAutoRegister === true,
441
+ nightlyGovernanceCronAutoRegister: cfg.nightlyGovernanceCronAutoRegister === true,
442
+ summaryRecallHours: typeof cfg.summaryRecallHours === "number" ? cfg.summaryRecallHours : 24,
443
+ maxSummaryCount: typeof cfg.maxSummaryCount === "number" ? cfg.maxSummaryCount : 6,
444
+ summaryModel: typeof cfg.summaryModel === "string" && cfg.summaryModel.length > 0 ? cfg.summaryModel : model,
445
+ // default: same as extraction model
446
+ // v2.4 Extended hourly summaries (default off)
447
+ hourlySummariesExtendedEnabled: cfg.hourlySummariesExtendedEnabled === true,
448
+ hourlySummariesIncludeToolStats: cfg.hourlySummariesIncludeToolStats === true,
449
+ hourlySummariesIncludeSystemMessages: cfg.hourlySummariesIncludeSystemMessages === true,
450
+ hourlySummariesMaxTurnsPerRun: typeof cfg.hourlySummariesMaxTurnsPerRun === "number" ? cfg.hourlySummariesMaxTurnsPerRun : 200,
451
+ // v2.4 Conversation index (default off)
452
+ conversationIndexEnabled: cfg.conversationIndexEnabled === true,
453
+ conversationIndexBackend: cfg.conversationIndexBackend === "faiss" ? "faiss" : "qmd",
454
+ conversationIndexQmdCollection: typeof cfg.conversationIndexQmdCollection === "string" && cfg.conversationIndexQmdCollection.length > 0 ? cfg.conversationIndexQmdCollection : "openclaw-engram-conversations",
455
+ conversationIndexRetentionDays: typeof cfg.conversationIndexRetentionDays === "number" ? cfg.conversationIndexRetentionDays : 30,
456
+ conversationIndexMinUpdateIntervalMs: typeof cfg.conversationIndexMinUpdateIntervalMs === "number" ? cfg.conversationIndexMinUpdateIntervalMs : 15 * 6e4,
457
+ conversationIndexEmbedOnUpdate: cfg.conversationIndexEmbedOnUpdate === true,
458
+ conversationIndexFaissScriptPath: typeof cfg.conversationIndexFaissScriptPath === "string" && cfg.conversationIndexFaissScriptPath.trim().length > 0 ? cfg.conversationIndexFaissScriptPath.trim() : void 0,
459
+ conversationIndexFaissPythonBin: typeof cfg.conversationIndexFaissPythonBin === "string" && cfg.conversationIndexFaissPythonBin.trim().length > 0 ? cfg.conversationIndexFaissPythonBin.trim() : void 0,
460
+ conversationIndexFaissModelId: typeof cfg.conversationIndexFaissModelId === "string" && cfg.conversationIndexFaissModelId.trim().length > 0 ? cfg.conversationIndexFaissModelId.trim() : "text-embedding-3-small",
461
+ conversationIndexFaissIndexDir: typeof cfg.conversationIndexFaissIndexDir === "string" && cfg.conversationIndexFaissIndexDir.trim().length > 0 ? cfg.conversationIndexFaissIndexDir.trim() : "state/conversation-index/faiss",
462
+ conversationIndexFaissUpsertTimeoutMs: typeof cfg.conversationIndexFaissUpsertTimeoutMs === "number" ? Math.max(0, Math.floor(cfg.conversationIndexFaissUpsertTimeoutMs)) : 3e4,
463
+ conversationIndexFaissSearchTimeoutMs: typeof cfg.conversationIndexFaissSearchTimeoutMs === "number" ? Math.max(0, Math.floor(cfg.conversationIndexFaissSearchTimeoutMs)) : 5e3,
464
+ conversationIndexFaissHealthTimeoutMs: typeof cfg.conversationIndexFaissHealthTimeoutMs === "number" ? Math.max(0, Math.floor(cfg.conversationIndexFaissHealthTimeoutMs)) : 2e3,
465
+ conversationIndexFaissMaxBatchSize: typeof cfg.conversationIndexFaissMaxBatchSize === "number" ? Math.max(0, Math.floor(cfg.conversationIndexFaissMaxBatchSize)) : 512,
466
+ conversationIndexFaissMaxSearchK: typeof cfg.conversationIndexFaissMaxSearchK === "number" ? Math.max(0, Math.floor(cfg.conversationIndexFaissMaxSearchK)) : 50,
467
+ conversationRecallTopK: typeof cfg.conversationRecallTopK === "number" ? cfg.conversationRecallTopK : 3,
468
+ conversationRecallMaxChars: typeof cfg.conversationRecallMaxChars === "number" ? cfg.conversationRecallMaxChars : 2500,
469
+ conversationRecallTimeoutMs: typeof cfg.conversationRecallTimeoutMs === "number" ? cfg.conversationRecallTimeoutMs : 800,
470
+ evalHarnessEnabled: cfg.evalHarnessEnabled === true,
471
+ evalShadowModeEnabled: cfg.evalShadowModeEnabled === true,
472
+ benchmarkBaselineSnapshotsEnabled: cfg.benchmarkBaselineSnapshotsEnabled === true,
473
+ benchmarkDeltaReporterEnabled: cfg.benchmarkDeltaReporterEnabled === true,
474
+ benchmarkStoredBaselineEnabled: cfg.benchmarkStoredBaselineEnabled === true,
475
+ evalStoreDir: typeof cfg.evalStoreDir === "string" && cfg.evalStoreDir.trim().length > 0 ? cfg.evalStoreDir.trim() : path.join(memoryDir, "state", "evals"),
476
+ objectiveStateMemoryEnabled: cfg.objectiveStateMemoryEnabled === true,
477
+ objectiveStateSnapshotWritesEnabled: cfg.objectiveStateSnapshotWritesEnabled === true,
478
+ objectiveStateRecallEnabled: cfg.objectiveStateRecallEnabled === true,
479
+ objectiveStateStoreDir: typeof cfg.objectiveStateStoreDir === "string" && cfg.objectiveStateStoreDir.trim().length > 0 ? cfg.objectiveStateStoreDir.trim() : path.join(memoryDir, "state", "objective-state"),
480
+ causalTrajectoryMemoryEnabled: cfg.causalTrajectoryMemoryEnabled === true,
481
+ causalTrajectoryStoreDir: typeof cfg.causalTrajectoryStoreDir === "string" && cfg.causalTrajectoryStoreDir.trim().length > 0 ? cfg.causalTrajectoryStoreDir.trim() : path.join(memoryDir, "state", "causal-trajectories"),
482
+ causalTrajectoryRecallEnabled: cfg.causalTrajectoryRecallEnabled === true,
483
+ actionGraphRecallEnabled: cfg.actionGraphRecallEnabled === true,
484
+ trustZonesEnabled: cfg.trustZonesEnabled === true,
485
+ quarantinePromotionEnabled: cfg.quarantinePromotionEnabled === true,
486
+ trustZoneStoreDir: typeof cfg.trustZoneStoreDir === "string" && cfg.trustZoneStoreDir.trim().length > 0 ? cfg.trustZoneStoreDir.trim() : path.join(memoryDir, "state", "trust-zones"),
487
+ trustZoneRecallEnabled: cfg.trustZoneRecallEnabled === true,
488
+ memoryPoisoningDefenseEnabled: cfg.memoryPoisoningDefenseEnabled === true,
489
+ memoryRedTeamBenchEnabled: cfg.memoryRedTeamBenchEnabled === true,
490
+ harmonicRetrievalEnabled: cfg.harmonicRetrievalEnabled === true,
491
+ abstractionAnchorsEnabled: cfg.abstractionAnchorsEnabled === true,
492
+ verifiedRecallEnabled: cfg.verifiedRecallEnabled === true,
493
+ semanticRulePromotionEnabled: cfg.semanticRulePromotionEnabled === true,
494
+ semanticRuleVerificationEnabled: cfg.semanticRuleVerificationEnabled === true,
495
+ semanticConsolidationEnabled: cfg.semanticConsolidationEnabled === true,
496
+ semanticConsolidationModel: typeof cfg.semanticConsolidationModel === "string" && cfg.semanticConsolidationModel.length > 0 ? cfg.semanticConsolidationModel : "auto",
497
+ semanticConsolidationThreshold: typeof cfg.semanticConsolidationThreshold === "number" ? cfg.semanticConsolidationThreshold : 0.8,
498
+ semanticConsolidationMinClusterSize: typeof cfg.semanticConsolidationMinClusterSize === "number" ? Math.max(2, Math.floor(cfg.semanticConsolidationMinClusterSize)) : 3,
499
+ semanticConsolidationExcludeCategories: Array.isArray(cfg.semanticConsolidationExcludeCategories) ? cfg.semanticConsolidationExcludeCategories.filter(
500
+ (c) => typeof c === "string" && c.length > 0
501
+ ) : ["correction", "commitment"],
502
+ semanticConsolidationIntervalHours: typeof cfg.semanticConsolidationIntervalHours === "number" ? Math.max(1, Math.floor(cfg.semanticConsolidationIntervalHours)) : 168,
503
+ semanticConsolidationMaxPerRun: typeof cfg.semanticConsolidationMaxPerRun === "number" ? Math.max(0, Math.floor(cfg.semanticConsolidationMaxPerRun)) : 100,
504
+ creationMemoryEnabled: cfg.creationMemoryEnabled === true,
505
+ memoryUtilityLearningEnabled: cfg.memoryUtilityLearningEnabled === true,
506
+ promotionByOutcomeEnabled: cfg.promotionByOutcomeEnabled === true,
507
+ commitmentLedgerEnabled: cfg.commitmentLedgerEnabled === true,
508
+ commitmentLifecycleEnabled: cfg.commitmentLifecycleEnabled === true,
509
+ commitmentStaleDays: typeof cfg.commitmentStaleDays === "number" ? cfg.commitmentStaleDays : 14,
510
+ commitmentLedgerDir: typeof cfg.commitmentLedgerDir === "string" && cfg.commitmentLedgerDir.trim().length > 0 ? cfg.commitmentLedgerDir.trim() : path.join(memoryDir, "state", "commitment-ledger"),
511
+ resumeBundlesEnabled: cfg.resumeBundlesEnabled === true,
512
+ resumeBundleDir: typeof cfg.resumeBundleDir === "string" && cfg.resumeBundleDir.trim().length > 0 ? cfg.resumeBundleDir.trim() : path.join(memoryDir, "state", "resume-bundles"),
513
+ workProductRecallEnabled: cfg.workProductRecallEnabled === true,
514
+ workTasksEnabled: cfg.workTasksEnabled === true,
515
+ workProjectsEnabled: cfg.workProjectsEnabled === true,
516
+ workTasksDir: typeof cfg.workTasksDir === "string" && cfg.workTasksDir.trim().length > 0 ? cfg.workTasksDir.trim() : path.join(memoryDir, "work", "tasks"),
517
+ workProjectsDir: typeof cfg.workProjectsDir === "string" && cfg.workProjectsDir.trim().length > 0 ? cfg.workProjectsDir.trim() : path.join(memoryDir, "work", "projects"),
518
+ workIndexEnabled: cfg.workIndexEnabled === true,
519
+ workIndexDir: typeof cfg.workIndexDir === "string" && cfg.workIndexDir.trim().length > 0 ? cfg.workIndexDir.trim() : path.join(memoryDir, "work", "index"),
520
+ workTaskIndexEnabled: cfg.workTaskIndexEnabled === true,
521
+ workProjectIndexEnabled: cfg.workProjectIndexEnabled === true,
522
+ workIndexAutoRebuildEnabled: cfg.workIndexAutoRebuildEnabled === true,
523
+ workIndexAutoRebuildDebounceMs: typeof cfg.workIndexAutoRebuildDebounceMs === "number" ? cfg.workIndexAutoRebuildDebounceMs : 1e3,
524
+ workProductLedgerDir: typeof cfg.workProductLedgerDir === "string" && cfg.workProductLedgerDir.trim().length > 0 ? cfg.workProductLedgerDir.trim() : path.join(memoryDir, "state", "work-product-ledger"),
525
+ abstractionNodeStoreDir: typeof cfg.abstractionNodeStoreDir === "string" && cfg.abstractionNodeStoreDir.trim().length > 0 ? cfg.abstractionNodeStoreDir.trim() : path.join(memoryDir, "state", "abstraction-nodes"),
526
+ // Local LLM Provider (v2.1)
527
+ localLlmEnabled: cfg.localLlmEnabled === true || cfg.localLlmEnabled === "true",
528
+ // default: false
529
+ localLlmUrl: typeof cfg.localLlmUrl === "string" && cfg.localLlmUrl.length > 0 ? cfg.localLlmUrl : "http://localhost:1234/v1",
530
+ localLlmModel: typeof cfg.localLlmModel === "string" && cfg.localLlmModel.length > 0 ? cfg.localLlmModel : "local-model",
531
+ localLlmApiKey: typeof cfg.localLlmApiKey === "string" && cfg.localLlmApiKey.length > 0 ? resolveEnvVars(cfg.localLlmApiKey) : void 0,
532
+ localLlmHeaders: cfg.localLlmHeaders && typeof cfg.localLlmHeaders === "object" && !Array.isArray(cfg.localLlmHeaders) ? Object.fromEntries(
533
+ Object.entries(cfg.localLlmHeaders).filter(([, value]) => typeof value === "string").map(([key, value]) => [key, String(value)])
534
+ ) : void 0,
535
+ localLlmAuthHeader: cfg.localLlmAuthHeader !== false,
536
+ localLlmFallback: cfg.localLlmFallback !== false,
537
+ // default: true
538
+ localLlmHomeDir: typeof cfg.localLlmHomeDir === "string" && cfg.localLlmHomeDir.length > 0 ? cfg.localLlmHomeDir : void 0,
539
+ localLmsCliPath: typeof cfg.localLmsCliPath === "string" && cfg.localLmsCliPath.length > 0 ? cfg.localLmsCliPath : void 0,
540
+ localLmsBinDir: typeof cfg.localLmsBinDir === "string" && cfg.localLmsBinDir.length > 0 ? cfg.localLmsBinDir : void 0,
541
+ localLlmTimeoutMs: typeof cfg.localLlmTimeoutMs === "number" ? cfg.localLlmTimeoutMs : 18e4,
542
+ localLlmMaxContext: typeof cfg.localLlmMaxContext === "number" ? cfg.localLlmMaxContext : void 0,
543
+ // Observability (disabled by default to avoid log spam)
544
+ slowLogEnabled: cfg.slowLogEnabled === true,
545
+ slowLogThresholdMs: typeof cfg.slowLogThresholdMs === "number" ? cfg.slowLogThresholdMs : 3e4,
546
+ // Trace recall content — disabled by default; enable to send recalled memory text to trace subscribers
547
+ traceRecallContent: cfg.traceRecallContent === true,
548
+ // Performance profiling (opt-in, disabled by default)
549
+ profilingEnabled: cfg.profilingEnabled === true,
550
+ profilingStorageDir: typeof cfg.profilingStorageDir === "string" && cfg.profilingStorageDir.length > 0 ? cfg.profilingStorageDir : path.join(memoryDir, "profiling"),
551
+ profilingMaxTraces: typeof cfg.profilingMaxTraces === "number" && Number.isFinite(cfg.profilingMaxTraces) ? Math.max(0, cfg.profilingMaxTraces) : 100,
552
+ // Extraction stability guards (P0/P1)
553
+ extractionDedupeEnabled: cfg.extractionDedupeEnabled !== false,
554
+ extractionDedupeWindowMs: typeof cfg.extractionDedupeWindowMs === "number" ? cfg.extractionDedupeWindowMs : 5 * 6e4,
555
+ extractionMinChars: typeof cfg.extractionMinChars === "number" ? cfg.extractionMinChars : 40,
556
+ extractionMinUserTurns: typeof cfg.extractionMinUserTurns === "number" ? cfg.extractionMinUserTurns : 1,
557
+ extractionMaxTurnChars: typeof cfg.extractionMaxTurnChars === "number" ? cfg.extractionMaxTurnChars : 4e3,
558
+ extractionMaxFactsPerRun: typeof cfg.extractionMaxFactsPerRun === "number" ? cfg.extractionMaxFactsPerRun : 12,
559
+ extractionMaxEntitiesPerRun: typeof cfg.extractionMaxEntitiesPerRun === "number" ? cfg.extractionMaxEntitiesPerRun : 6,
560
+ extractionMaxQuestionsPerRun: typeof cfg.extractionMaxQuestionsPerRun === "number" ? cfg.extractionMaxQuestionsPerRun : 3,
561
+ extractionMaxProfileUpdatesPerRun: typeof cfg.extractionMaxProfileUpdatesPerRun === "number" ? cfg.extractionMaxProfileUpdatesPerRun : 4,
562
+ consolidationRequireNonZeroExtraction: cfg.consolidationRequireNonZeroExtraction !== false,
563
+ consolidationMinIntervalMs: typeof cfg.consolidationMinIntervalMs === "number" ? cfg.consolidationMinIntervalMs : 10 * 6e4,
564
+ // QMD maintenance (debounced singleflight)
565
+ qmdMaintenanceEnabled: cfg.qmdMaintenanceEnabled !== false,
566
+ qmdMaintenanceDebounceMs: typeof cfg.qmdMaintenanceDebounceMs === "number" ? cfg.qmdMaintenanceDebounceMs : 3e4,
567
+ qmdAutoEmbedEnabled: cfg.qmdAutoEmbedEnabled === true,
568
+ qmdEmbedMinIntervalMs: typeof cfg.qmdEmbedMinIntervalMs === "number" ? cfg.qmdEmbedMinIntervalMs : 60 * 6e4,
569
+ qmdUpdateTimeoutMs: typeof cfg.qmdUpdateTimeoutMs === "number" ? cfg.qmdUpdateTimeoutMs : 9e4,
570
+ qmdUpdateMinIntervalMs: typeof cfg.qmdUpdateMinIntervalMs === "number" ? cfg.qmdUpdateMinIntervalMs : 15 * 6e4,
571
+ // Local LLM resilience
572
+ localLlmRetry5xxCount: typeof cfg.localLlmRetry5xxCount === "number" ? cfg.localLlmRetry5xxCount : 1,
573
+ localLlmRetryBackoffMs: typeof cfg.localLlmRetryBackoffMs === "number" ? cfg.localLlmRetryBackoffMs : 400,
574
+ localLlm400TripThreshold: typeof cfg.localLlm400TripThreshold === "number" ? cfg.localLlm400TripThreshold : 5,
575
+ localLlm400CooldownMs: typeof cfg.localLlm400CooldownMs === "number" ? cfg.localLlm400CooldownMs : 12e4,
576
+ // Local LLM fast tier (v9.1)
577
+ localLlmFastEnabled: cfg.localLlmFastEnabled === true,
578
+ localLlmFastModel: typeof cfg.localLlmFastModel === "string" && cfg.localLlmFastModel.length > 0 ? cfg.localLlmFastModel : "",
579
+ 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
+ localLlmFastTimeoutMs: typeof cfg.localLlmFastTimeoutMs === "number" ? cfg.localLlmFastTimeoutMs : 15e3,
581
+ // Gateway config (passed from index.ts for fallback AI)
582
+ gatewayConfig: cfg.gatewayConfig,
583
+ // Gateway model source (v9.2) — route LLM calls through gateway agent model chain
584
+ modelSource: cfg.modelSource === "gateway" ? "gateway" : "plugin",
585
+ gatewayAgentId: typeof cfg.gatewayAgentId === "string" && cfg.gatewayAgentId.length > 0 ? cfg.gatewayAgentId : "",
586
+ fastGatewayAgentId: typeof cfg.fastGatewayAgentId === "string" && cfg.fastGatewayAgentId.length > 0 ? cfg.fastGatewayAgentId : "",
587
+ // v3.0 namespaces (default off)
588
+ namespacesEnabled: cfg.namespacesEnabled === true,
589
+ defaultNamespace: typeof cfg.defaultNamespace === "string" && cfg.defaultNamespace.length > 0 ? cfg.defaultNamespace : "default",
590
+ sharedNamespace: typeof cfg.sharedNamespace === "string" && cfg.sharedNamespace.length > 0 ? cfg.sharedNamespace : "shared",
591
+ principalFromSessionKeyMode: cfg.principalFromSessionKeyMode === "prefix" ? "prefix" : cfg.principalFromSessionKeyMode === "regex" ? "regex" : "map",
592
+ principalFromSessionKeyRules: principalRules,
593
+ namespacePolicies: Array.isArray(cfg.namespacePolicies) ? cfg.namespacePolicies.map((p) => ({
594
+ name: typeof p?.name === "string" ? p.name : "",
595
+ readPrincipals: Array.isArray(p?.readPrincipals) ? p.readPrincipals.filter((x) => typeof x === "string") : [],
596
+ writePrincipals: Array.isArray(p?.writePrincipals) ? p.writePrincipals.filter((x) => typeof x === "string") : [],
597
+ includeInRecallByDefault: p?.includeInRecallByDefault === true
598
+ })).filter((p) => p.name.length > 0) : [],
599
+ defaultRecallNamespaces: Array.isArray(cfg.defaultRecallNamespaces) ? ["self", "shared"].filter((x) => cfg.defaultRecallNamespaces.includes(x)) : ["self", "shared"],
600
+ cronRecallMode: cfg.cronRecallMode === "none" ? "none" : cfg.cronRecallMode === "allowlist" ? "allowlist" : "all",
601
+ cronRecallAllowlist: Array.isArray(cfg.cronRecallAllowlist) ? cfg.cronRecallAllowlist.filter((v) => typeof v === "string" && v.length > 0) : [],
602
+ cronRecallPolicyEnabled: cfg.cronRecallPolicyEnabled !== false,
603
+ cronRecallNormalizedQueryMaxChars: typeof cfg.cronRecallNormalizedQueryMaxChars === "number" ? cfg.cronRecallNormalizedQueryMaxChars : 480,
604
+ cronRecallInstructionHeavyTokenCap: typeof cfg.cronRecallInstructionHeavyTokenCap === "number" ? cfg.cronRecallInstructionHeavyTokenCap : 36,
605
+ cronConversationRecallMode: cfg.cronConversationRecallMode === "always" ? "always" : cfg.cronConversationRecallMode === "never" ? "never" : "auto",
606
+ autoPromoteToSharedEnabled: cfg.autoPromoteToSharedEnabled === true,
607
+ autoPromoteToSharedCategories: Array.isArray(cfg.autoPromoteToSharedCategories) ? cfg.autoPromoteToSharedCategories.filter((c) => c === "fact" || c === "correction" || c === "decision" || c === "preference") : ["fact", "correction", "decision", "preference"],
608
+ autoPromoteMinConfidenceTier: cfg.autoPromoteMinConfidenceTier === "explicit" ? "explicit" : cfg.autoPromoteMinConfidenceTier === "implied" ? "implied" : "explicit",
609
+ routingRulesEnabled: cfg.routingRulesEnabled === true,
610
+ routingRulesStateFile: typeof cfg.routingRulesStateFile === "string" && cfg.routingRulesStateFile.trim().length > 0 ? cfg.routingRulesStateFile.trim() : "state/routing-rules.json",
611
+ // v4.0 shared-context (default off)
612
+ sharedContextEnabled: cfg.sharedContextEnabled === true,
613
+ sharedContextDir: typeof cfg.sharedContextDir === "string" && cfg.sharedContextDir.length > 0 ? cfg.sharedContextDir : void 0,
614
+ sharedContextMaxInjectChars: typeof cfg.sharedContextMaxInjectChars === "number" ? cfg.sharedContextMaxInjectChars : 4e3,
615
+ sharedCrossSignalSemanticEnabled,
616
+ sharedCrossSignalSemanticTimeoutMs,
617
+ sharedCrossSignalSemanticMaxCandidates: typeof cfg.sharedCrossSignalSemanticMaxCandidates === "number" ? Math.max(0, Math.floor(cfg.sharedCrossSignalSemanticMaxCandidates)) : 120,
618
+ // Backward-compatible aliases.
619
+ crossSignalsSemanticEnabled: sharedCrossSignalSemanticEnabled,
620
+ crossSignalsSemanticTimeoutMs: sharedCrossSignalSemanticTimeoutMs,
621
+ // v5.0 compounding (default off)
622
+ compoundingEnabled: cfg.compoundingEnabled === true,
623
+ compoundingWeeklyCronEnabled: cfg.compoundingWeeklyCronEnabled === true,
624
+ compoundingSemanticEnabled: cfg.compoundingSemanticEnabled === true,
625
+ compoundingSynthesisTimeoutMs: typeof cfg.compoundingSynthesisTimeoutMs === "number" ? cfg.compoundingSynthesisTimeoutMs : 15e3,
626
+ compoundingInjectEnabled: cfg.compoundingInjectEnabled !== false,
627
+ // IRC (Inductive Rule Consolidation) — preference synthesis
628
+ ircEnabled: cfg.ircEnabled !== false,
629
+ ircMaxPreferences: typeof cfg.ircMaxPreferences === "number" ? cfg.ircMaxPreferences : 20,
630
+ ircIncludeCorrections: cfg.ircIncludeCorrections !== false,
631
+ ircMinConfidence: typeof cfg.ircMinConfidence === "number" ? cfg.ircMinConfidence : 0.3,
632
+ // CMC (Causal Memory Consolidation) — cross-session causal reasoning
633
+ cmcEnabled: cfg.cmcEnabled === true,
634
+ cmcStitchLookbackDays: typeof cfg.cmcStitchLookbackDays === "number" ? cfg.cmcStitchLookbackDays : 7,
635
+ cmcStitchMinScore: typeof cfg.cmcStitchMinScore === "number" ? cfg.cmcStitchMinScore : 2.5,
636
+ cmcStitchMaxEdgesPerTrajectory: typeof cfg.cmcStitchMaxEdgesPerTrajectory === "number" ? cfg.cmcStitchMaxEdgesPerTrajectory : 3,
637
+ cmcConsolidationEnabled: cfg.cmcConsolidationEnabled === true,
638
+ cmcConsolidationMinRecurrence: typeof cfg.cmcConsolidationMinRecurrence === "number" ? cfg.cmcConsolidationMinRecurrence : 3,
639
+ cmcConsolidationMinSessions: typeof cfg.cmcConsolidationMinSessions === "number" ? cfg.cmcConsolidationMinSessions : 2,
640
+ cmcConsolidationSuccessThreshold: typeof cfg.cmcConsolidationSuccessThreshold === "number" ? cfg.cmcConsolidationSuccessThreshold : 0.7,
641
+ cmcRetrievalEnabled: cfg.cmcRetrievalEnabled === true,
642
+ cmcRetrievalMaxDepth: typeof cfg.cmcRetrievalMaxDepth === "number" ? cfg.cmcRetrievalMaxDepth : 3,
643
+ cmcRetrievalMaxChars: typeof cfg.cmcRetrievalMaxChars === "number" ? cfg.cmcRetrievalMaxChars : 800,
644
+ cmcRetrievalCounterfactualBoost: typeof cfg.cmcRetrievalCounterfactualBoost === "number" ? cfg.cmcRetrievalCounterfactualBoost : 0.4,
645
+ cmcBehaviorLearningEnabled: cfg.cmcBehaviorLearningEnabled === true,
646
+ cmcBehaviorMinFrequency: typeof cfg.cmcBehaviorMinFrequency === "number" ? cfg.cmcBehaviorMinFrequency : 3,
647
+ cmcBehaviorMinSessions: typeof cfg.cmcBehaviorMinSessions === "number" ? cfg.cmcBehaviorMinSessions : 2,
648
+ cmcBehaviorConfidenceThreshold: typeof cfg.cmcBehaviorConfidenceThreshold === "number" ? cfg.cmcBehaviorConfidenceThreshold : 0.6,
649
+ cmcLifecycleCausalImpactWeight: typeof cfg.cmcLifecycleCausalImpactWeight === "number" ? cfg.cmcLifecycleCausalImpactWeight : 0.05,
650
+ // PEDC (Prediction-Error-Driven Calibration) — model-user alignment
651
+ calibrationEnabled: cfg.calibrationEnabled === true,
652
+ calibrationMaxRulesPerRecall: typeof cfg.calibrationMaxRulesPerRecall === "number" ? cfg.calibrationMaxRulesPerRecall : 10,
653
+ calibrationMaxChars: typeof cfg.calibrationMaxChars === "number" ? cfg.calibrationMaxChars : 1200,
654
+ // v7.0 Knowledge Graph Enhancement
655
+ knowledgeIndexEnabled: cfg.knowledgeIndexEnabled !== false,
656
+ knowledgeIndexMaxEntities: typeof cfg.knowledgeIndexMaxEntities === "number" ? cfg.knowledgeIndexMaxEntities : 40,
657
+ knowledgeIndexMaxChars: typeof cfg.knowledgeIndexMaxChars === "number" ? cfg.knowledgeIndexMaxChars : 4e3,
658
+ entityRetrievalEnabled: cfg.entityRetrievalEnabled !== false,
659
+ entityRetrievalMaxChars: typeof cfg.entityRetrievalMaxChars === "number" ? cfg.entityRetrievalMaxChars : 2400,
660
+ entityRetrievalMaxHints: typeof cfg.entityRetrievalMaxHints === "number" ? cfg.entityRetrievalMaxHints : 2,
661
+ entityRetrievalMaxSupportingFacts: typeof cfg.entityRetrievalMaxSupportingFacts === "number" ? cfg.entityRetrievalMaxSupportingFacts : 6,
662
+ entityRetrievalMaxRelatedEntities: typeof cfg.entityRetrievalMaxRelatedEntities === "number" ? cfg.entityRetrievalMaxRelatedEntities : 3,
663
+ entityRetrievalRecentTurns: typeof cfg.entityRetrievalRecentTurns === "number" ? cfg.entityRetrievalRecentTurns : 6,
664
+ recallBudgetChars: recallPipelineConfig.recallBudgetChars,
665
+ recallOuterTimeoutMs: typeof cfg.recallOuterTimeoutMs === "number" ? Math.max(0, Math.floor(cfg.recallOuterTimeoutMs)) : 75e3,
666
+ recallCoreDeadlineMs: typeof cfg.recallCoreDeadlineMs === "number" ? Math.max(0, Math.floor(cfg.recallCoreDeadlineMs)) : 75e3,
667
+ recallEnrichmentDeadlineMs: typeof cfg.recallEnrichmentDeadlineMs === "number" ? Math.max(0, Math.floor(cfg.recallEnrichmentDeadlineMs)) : 25e3,
668
+ recallPipeline: recallPipelineConfig.pipeline,
669
+ qmdRecallCacheTtlMs: typeof cfg.qmdRecallCacheTtlMs === "number" ? Math.max(0, Math.floor(cfg.qmdRecallCacheTtlMs)) : 6e4,
670
+ qmdRecallCacheStaleTtlMs: typeof cfg.qmdRecallCacheStaleTtlMs === "number" ? Math.max(0, Math.floor(cfg.qmdRecallCacheStaleTtlMs)) : 10 * 6e4,
671
+ qmdRecallCacheMaxEntries: typeof cfg.qmdRecallCacheMaxEntries === "number" ? Math.max(0, Math.floor(cfg.qmdRecallCacheMaxEntries)) : 128,
672
+ entityRelationshipsEnabled: cfg.entityRelationshipsEnabled !== false,
673
+ entityActivityLogEnabled: cfg.entityActivityLogEnabled !== false,
674
+ entityActivityLogMaxEntries: typeof cfg.entityActivityLogMaxEntries === "number" ? cfg.entityActivityLogMaxEntries : 20,
675
+ entityAliasesEnabled: cfg.entityAliasesEnabled !== false,
676
+ entitySummaryEnabled: cfg.entitySummaryEnabled !== false,
677
+ // Search backend abstraction
678
+ searchBackend: ["qmd", "remote", "noop", "lancedb", "meilisearch", "orama"].includes(cfg.searchBackend) ? cfg.searchBackend : "qmd",
679
+ remoteSearchBaseUrl: typeof cfg.remoteSearchBaseUrl === "string" ? cfg.remoteSearchBaseUrl : void 0,
680
+ remoteSearchApiKey: typeof cfg.remoteSearchApiKey === "string" ? cfg.remoteSearchApiKey : void 0,
681
+ remoteSearchTimeoutMs: typeof cfg.remoteSearchTimeoutMs === "number" ? cfg.remoteSearchTimeoutMs : 3e4,
682
+ // LanceDB backend
683
+ lancedbEnabled: cfg.lancedbEnabled === true,
684
+ lanceDbPath: typeof cfg.lanceDbPath === "string" ? cfg.lanceDbPath : path.join(memoryDir, "lancedb"),
685
+ lanceEmbeddingDimension: typeof cfg.lanceEmbeddingDimension === "number" ? cfg.lanceEmbeddingDimension : 1536,
686
+ // Meilisearch backend
687
+ meilisearchEnabled: cfg.meilisearchEnabled === true,
688
+ meilisearchHost: typeof cfg.meilisearchHost === "string" ? cfg.meilisearchHost : "http://localhost:7700",
689
+ meilisearchApiKey: typeof cfg.meilisearchApiKey === "string" ? cfg.meilisearchApiKey : void 0,
690
+ meilisearchTimeoutMs: typeof cfg.meilisearchTimeoutMs === "number" ? cfg.meilisearchTimeoutMs : 3e4,
691
+ meilisearchAutoIndex: cfg.meilisearchAutoIndex === true,
692
+ // Orama backend
693
+ oramaEnabled: cfg.oramaEnabled === true,
694
+ oramaDbPath: typeof cfg.oramaDbPath === "string" ? cfg.oramaDbPath : path.join(memoryDir, "orama"),
695
+ oramaEmbeddingDimension: typeof cfg.oramaEmbeddingDimension === "number" ? cfg.oramaEmbeddingDimension : 1536,
696
+ // QMD daemon mode
697
+ qmdDaemonEnabled: cfg.qmdDaemonEnabled !== false,
698
+ qmdDaemonUrl: typeof cfg.qmdDaemonUrl === "string" && cfg.qmdDaemonUrl.length > 0 ? cfg.qmdDaemonUrl : "http://localhost:8181/mcp",
699
+ qmdDaemonRecheckIntervalMs: typeof cfg.qmdDaemonRecheckIntervalMs === "number" ? cfg.qmdDaemonRecheckIntervalMs : 15e3,
700
+ qmdIntentHintsEnabled: cfg.qmdIntentHintsEnabled === true,
701
+ qmdExplainEnabled: cfg.qmdExplainEnabled === true,
702
+ // v6.0 Fact deduplication & archival
703
+ factDeduplicationEnabled: cfg.factDeduplicationEnabled !== false,
704
+ factArchivalEnabled: cfg.factArchivalEnabled === true,
705
+ factArchivalAgeDays: typeof cfg.factArchivalAgeDays === "number" ? cfg.factArchivalAgeDays : 90,
706
+ factArchivalMaxImportance: typeof cfg.factArchivalMaxImportance === "number" ? cfg.factArchivalMaxImportance : 0.3,
707
+ 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"],
709
+ // v8.3 lifecycle policy engine (default off)
710
+ lifecyclePolicyEnabled: cfg.lifecyclePolicyEnabled === true,
711
+ lifecycleFilterStaleEnabled: cfg.lifecycleFilterStaleEnabled === true,
712
+ lifecyclePromoteHeatThreshold: typeof cfg.lifecyclePromoteHeatThreshold === "number" ? Math.min(1, Math.max(0, cfg.lifecyclePromoteHeatThreshold)) : 0.55,
713
+ lifecycleStaleDecayThreshold: typeof cfg.lifecycleStaleDecayThreshold === "number" ? Math.min(1, Math.max(0, cfg.lifecycleStaleDecayThreshold)) : 0.65,
714
+ lifecycleArchiveDecayThreshold: typeof cfg.lifecycleArchiveDecayThreshold === "number" ? Math.min(1, Math.max(0, cfg.lifecycleArchiveDecayThreshold)) : 0.85,
715
+ lifecycleProtectedCategories: Array.isArray(cfg.lifecycleProtectedCategories) ? cfg.lifecycleProtectedCategories.filter(
716
+ (c) => typeof c === "string" && VALID_MEMORY_CATEGORIES.has(c)
717
+ ) : ["decision", "principle", "commitment", "preference"],
718
+ lifecycleMetricsEnabled: typeof cfg.lifecycleMetricsEnabled === "boolean" ? cfg.lifecycleMetricsEnabled : cfg.lifecyclePolicyEnabled === true,
719
+ // v8.3 proactive + policy learning (default off)
720
+ proactiveExtractionEnabled: cfg.proactiveExtractionEnabled === true,
721
+ contextCompressionActionsEnabled: cfg.contextCompressionActionsEnabled === true,
722
+ compressionGuidelineLearningEnabled: cfg.compressionGuidelineLearningEnabled === true,
723
+ compressionGuidelineSemanticRefinementEnabled: cfg.compressionGuidelineSemanticRefinementEnabled === true,
724
+ compressionGuidelineSemanticTimeoutMs: typeof cfg.compressionGuidelineSemanticTimeoutMs === "number" ? Math.max(1, Math.floor(cfg.compressionGuidelineSemanticTimeoutMs)) : 2500,
725
+ maxProactiveQuestionsPerExtraction: typeof cfg.maxProactiveQuestionsPerExtraction === "number" ? Math.max(0, Math.floor(cfg.maxProactiveQuestionsPerExtraction)) : 2,
726
+ proactiveExtractionTimeoutMs: typeof cfg.proactiveExtractionTimeoutMs === "number" ? Math.max(0, Math.floor(cfg.proactiveExtractionTimeoutMs)) : 2500,
727
+ proactiveExtractionMaxTokens: typeof cfg.proactiveExtractionMaxTokens === "number" ? Math.max(0, Math.floor(cfg.proactiveExtractionMaxTokens)) : 900,
728
+ extractionMaxOutputTokens: typeof cfg.extractionMaxOutputTokens === "number" ? Math.max(1, Math.floor(cfg.extractionMaxOutputTokens)) : 16384,
729
+ proactiveExtractionCategoryAllowlist: Array.isArray(cfg.proactiveExtractionCategoryAllowlist) ? cfg.proactiveExtractionCategoryAllowlist.filter(
730
+ (category) => typeof category === "string" && VALID_MEMORY_CATEGORIES.has(category)
731
+ ) : void 0,
732
+ maxCompressionTokensPerHour: typeof cfg.maxCompressionTokensPerHour === "number" ? Math.max(0, Math.floor(cfg.maxCompressionTokensPerHour)) : 1500,
733
+ behaviorLoopAutoTuneEnabled: cfg.behaviorLoopAutoTuneEnabled === true,
734
+ behaviorLoopLearningWindowDays: typeof cfg.behaviorLoopLearningWindowDays === "number" ? Math.max(0, Math.floor(cfg.behaviorLoopLearningWindowDays)) : 14,
735
+ behaviorLoopMinSignalCount: typeof cfg.behaviorLoopMinSignalCount === "number" ? Math.max(0, Math.floor(cfg.behaviorLoopMinSignalCount)) : 10,
736
+ behaviorLoopMaxDeltaPerCycle: typeof cfg.behaviorLoopMaxDeltaPerCycle === "number" ? Math.min(1, Math.max(0, cfg.behaviorLoopMaxDeltaPerCycle)) : 0.1,
737
+ behaviorLoopProtectedParams: Array.isArray(cfg.behaviorLoopProtectedParams) ? cfg.behaviorLoopProtectedParams.filter((param) => typeof param === "string" && param.trim().length > 0) : [...DEFAULT_BEHAVIOR_LOOP_PROTECTED_PARAMS],
738
+ // v8.0 phase 1
739
+ recallPlannerEnabled: cfg.recallPlannerEnabled !== false,
740
+ recallPlannerModel: typeof cfg.recallPlannerModel === "string" && cfg.recallPlannerModel.trim().length > 0 ? cfg.recallPlannerModel.trim() : "gpt-5.2-mini",
741
+ recallPlannerTimeoutMs: typeof cfg.recallPlannerTimeoutMs === "number" ? cfg.recallPlannerTimeoutMs : 1500,
742
+ recallPlannerUseResponsesApi: cfg.recallPlannerUseResponsesApi !== false,
743
+ recallPlannerMaxPromptChars: typeof cfg.recallPlannerMaxPromptChars === "number" ? cfg.recallPlannerMaxPromptChars : 4e3,
744
+ recallPlannerMaxMemoryHints: typeof cfg.recallPlannerMaxMemoryHints === "number" ? cfg.recallPlannerMaxMemoryHints : 24,
745
+ recallPlannerShadowMode: cfg.recallPlannerShadowMode === true,
746
+ recallPlannerTelemetryEnabled: cfg.recallPlannerTelemetryEnabled !== false,
747
+ recallPlannerMaxQmdResultsMinimal: typeof cfg.recallPlannerMaxQmdResultsMinimal === "number" ? cfg.recallPlannerMaxQmdResultsMinimal : 4,
748
+ recallPlannerMaxQmdResultsFull: typeof cfg.recallPlannerMaxQmdResultsFull === "number" ? cfg.recallPlannerMaxQmdResultsFull : 8,
749
+ intentRoutingEnabled: cfg.intentRoutingEnabled === true,
750
+ intentRoutingBoost: typeof cfg.intentRoutingBoost === "number" ? cfg.intentRoutingBoost : 0.12,
751
+ verbatimArtifactsEnabled: cfg.verbatimArtifactsEnabled === true,
752
+ verbatimArtifactsMinConfidence: typeof cfg.verbatimArtifactsMinConfidence === "number" ? cfg.verbatimArtifactsMinConfidence : 0.8,
753
+ verbatimArtifactsMaxRecall: typeof cfg.verbatimArtifactsMaxRecall === "number" ? cfg.verbatimArtifactsMaxRecall : 5,
754
+ verbatimArtifactCategories: Array.isArray(cfg.verbatimArtifactCategories) ? cfg.verbatimArtifactCategories.filter(
755
+ (c) => typeof c === "string" && VALID_MEMORY_CATEGORIES.has(c)
756
+ ) : ["decision", "correction", "principle", "commitment"],
757
+ // v8.0 Phase 2A: Memory Boxes + Trace Weaving
758
+ memoryBoxesEnabled: cfg.memoryBoxesEnabled === true,
759
+ boxTopicShiftThreshold: typeof cfg.boxTopicShiftThreshold === "number" ? cfg.boxTopicShiftThreshold : 0.35,
760
+ boxTimeGapMs: typeof cfg.boxTimeGapMs === "number" ? cfg.boxTimeGapMs : 30 * 60 * 1e3,
761
+ boxMaxMemories: typeof cfg.boxMaxMemories === "number" ? cfg.boxMaxMemories : 50,
762
+ traceWeaverEnabled: cfg.traceWeaverEnabled === true,
763
+ traceWeaverLookbackDays: typeof cfg.traceWeaverLookbackDays === "number" ? cfg.traceWeaverLookbackDays : 7,
764
+ traceWeaverOverlapThreshold: typeof cfg.traceWeaverOverlapThreshold === "number" ? cfg.traceWeaverOverlapThreshold : 0.4,
765
+ boxRecallDays: typeof cfg.boxRecallDays === "number" ? cfg.boxRecallDays : 3,
766
+ // v8.0 Phase 2B: Episode/Note dual store (HiMem)
767
+ episodeNoteModeEnabled: cfg.episodeNoteModeEnabled === true,
768
+ // v8.1: Temporal + Tag Indexes (SwiftMem-inspired)
769
+ queryAwareIndexingEnabled: cfg.queryAwareIndexingEnabled === true,
770
+ queryAwareIndexingMaxCandidates: typeof cfg.queryAwareIndexingMaxCandidates === "number" ? Math.max(0, cfg.queryAwareIndexingMaxCandidates) : 200,
771
+ temporalIndexWindowDays: typeof cfg.temporalIndexWindowDays === "number" ? cfg.temporalIndexWindowDays : 30,
772
+ temporalIndexMaxEntries: typeof cfg.temporalIndexMaxEntries === "number" ? cfg.temporalIndexMaxEntries : 5e3,
773
+ temporalBoostRecentDays: typeof cfg.temporalBoostRecentDays === "number" ? cfg.temporalBoostRecentDays : 7,
774
+ temporalBoostScore: typeof cfg.temporalBoostScore === "number" ? cfg.temporalBoostScore : 0.15,
775
+ temporalDecayEnabled: cfg.temporalDecayEnabled !== false,
776
+ tagMemoryEnabled: cfg.tagMemoryEnabled === true,
777
+ tagMaxPerMemory: typeof cfg.tagMaxPerMemory === "number" ? cfg.tagMaxPerMemory : 5,
778
+ tagIndexMaxEntries: typeof cfg.tagIndexMaxEntries === "number" ? cfg.tagIndexMaxEntries : 1e4,
779
+ tagRecallBoost: typeof cfg.tagRecallBoost === "number" ? cfg.tagRecallBoost : 0.15,
780
+ tagRecallMaxMatches: typeof cfg.tagRecallMaxMatches === "number" ? cfg.tagRecallMaxMatches : 10,
781
+ // v8.2: Multi-graph memory (PR 18)
782
+ multiGraphMemoryEnabled: cfg.multiGraphMemoryEnabled === true,
783
+ graphRecallEnabled: cfg.graphRecallEnabled === true,
784
+ graphRecallMaxExpansions: typeof cfg.graphRecallMaxExpansions === "number" ? cfg.graphRecallMaxExpansions : 3,
785
+ graphRecallMaxPerSeed: typeof cfg.graphRecallMaxPerSeed === "number" ? cfg.graphRecallMaxPerSeed : 5,
786
+ graphRecallMinEdgeWeight: typeof cfg.graphRecallMinEdgeWeight === "number" ? cfg.graphRecallMinEdgeWeight : 0.1,
787
+ graphRecallShadowEnabled: cfg.graphRecallShadowEnabled === true,
788
+ graphRecallSnapshotEnabled: cfg.graphRecallSnapshotEnabled === true,
789
+ graphRecallShadowSampleRate: typeof cfg.graphRecallShadowSampleRate === "number" ? cfg.graphRecallShadowSampleRate : 0.1,
790
+ graphRecallExplainToolEnabled: cfg.graphRecallExplainToolEnabled === true,
791
+ graphRecallStoreColdMirror: cfg.graphRecallStoreColdMirror === true,
792
+ graphRecallColdMirrorCollection: typeof cfg.graphRecallColdMirrorCollection === "string" && cfg.graphRecallColdMirrorCollection.trim().length > 0 ? cfg.graphRecallColdMirrorCollection.trim() : void 0,
793
+ graphRecallColdMirrorMinAgeDays: typeof cfg.graphRecallColdMirrorMinAgeDays === "number" ? cfg.graphRecallColdMirrorMinAgeDays : 7,
794
+ graphRecallUseEntityPriors: cfg.graphRecallUseEntityPriors === true,
795
+ graphRecallEntityPriorBoost: typeof cfg.graphRecallEntityPriorBoost === "number" ? cfg.graphRecallEntityPriorBoost : 0.2,
796
+ graphRecallPreferHubSeeds: cfg.graphRecallPreferHubSeeds === true,
797
+ graphRecallHubBias: typeof cfg.graphRecallHubBias === "number" ? cfg.graphRecallHubBias : 0.3,
798
+ graphRecallRecencyHalfLifeDays: typeof cfg.graphRecallRecencyHalfLifeDays === "number" ? cfg.graphRecallRecencyHalfLifeDays : 30,
799
+ graphRecallDampingFactor: typeof cfg.graphRecallDampingFactor === "number" ? cfg.graphRecallDampingFactor : 0.85,
800
+ graphRecallMaxSeedNodes: typeof cfg.graphRecallMaxSeedNodes === "number" ? cfg.graphRecallMaxSeedNodes : 10,
801
+ graphRecallMaxExpandedNodes: typeof cfg.graphRecallMaxExpandedNodes === "number" ? cfg.graphRecallMaxExpandedNodes : 30,
802
+ graphRecallMaxTrailPerNode: typeof cfg.graphRecallMaxTrailPerNode === "number" ? cfg.graphRecallMaxTrailPerNode : 5,
803
+ graphRecallMinSeedScore: typeof cfg.graphRecallMinSeedScore === "number" ? cfg.graphRecallMinSeedScore : 0.3,
804
+ graphRecallExpansionScoreThreshold: typeof cfg.graphRecallExpansionScoreThreshold === "number" ? cfg.graphRecallExpansionScoreThreshold : 0.2,
805
+ graphRecallExplainMaxPaths: typeof cfg.graphRecallExplainMaxPaths === "number" ? cfg.graphRecallExplainMaxPaths : 3,
806
+ graphRecallExplainMaxChars: typeof cfg.graphRecallExplainMaxChars === "number" ? cfg.graphRecallExplainMaxChars : 500,
807
+ graphRecallExplainEdgeLimit: typeof cfg.graphRecallExplainEdgeLimit === "number" ? cfg.graphRecallExplainEdgeLimit : 5,
808
+ graphRecallExplainEnabled: cfg.graphRecallExplainEnabled === true,
809
+ graphRecallEntityHintsEnabled: cfg.graphRecallEntityHintsEnabled === true,
810
+ graphRecallEntityHintMax: typeof cfg.graphRecallEntityHintMax === "number" ? cfg.graphRecallEntityHintMax : 3,
811
+ graphRecallEntityHintMaxChars: typeof cfg.graphRecallEntityHintMaxChars === "number" ? cfg.graphRecallEntityHintMaxChars : 200,
812
+ graphRecallSnapshotDir: typeof cfg.graphRecallSnapshotDir === "string" && cfg.graphRecallSnapshotDir.trim().length > 0 ? cfg.graphRecallSnapshotDir.trim() : path.join(memoryDir, "state", "graph"),
813
+ graphRecallEnableTrace: cfg.graphRecallEnableTrace === true,
814
+ graphRecallEnableDebug: cfg.graphRecallEnableDebug === true,
815
+ graphExpandedIntentEnabled: cfg.graphExpandedIntentEnabled !== false,
816
+ graphAssistInFullModeEnabled: cfg.graphAssistInFullModeEnabled !== false,
817
+ graphAssistShadowEvalEnabled: cfg.graphAssistShadowEvalEnabled === true,
818
+ graphAssistMinSeedResults: typeof cfg.graphAssistMinSeedResults === "number" ? Math.max(1, Math.floor(cfg.graphAssistMinSeedResults)) : 3,
819
+ entityGraphEnabled: cfg.entityGraphEnabled !== false,
820
+ timeGraphEnabled: cfg.timeGraphEnabled !== false,
821
+ graphWriteSessionAdjacencyEnabled: cfg.graphWriteSessionAdjacencyEnabled !== false,
822
+ causalGraphEnabled: cfg.causalGraphEnabled !== false,
823
+ maxGraphTraversalSteps: typeof cfg.maxGraphTraversalSteps === "number" ? Math.max(0, cfg.maxGraphTraversalSteps) : 3,
824
+ graphActivationDecay: typeof cfg.graphActivationDecay === "number" ? Math.min(1, Math.max(0, cfg.graphActivationDecay)) : 0.7,
825
+ graphExpansionActivationWeight: typeof cfg.graphExpansionActivationWeight === "number" ? Math.min(1, Math.max(0, cfg.graphExpansionActivationWeight)) : 0.65,
826
+ graphExpansionBlendMin: typeof cfg.graphExpansionBlendMin === "number" ? Math.min(1, Math.max(0, cfg.graphExpansionBlendMin)) : 0.05,
827
+ graphExpansionBlendMax: typeof cfg.graphExpansionBlendMax === "number" ? Math.min(1, Math.max(0, cfg.graphExpansionBlendMax)) : 0.95,
828
+ maxEntityGraphEdgesPerMemory: typeof cfg.maxEntityGraphEdgesPerMemory === "number" ? Math.max(0, cfg.maxEntityGraphEdgesPerMemory) : 10,
829
+ delinearizeEnabled: cfg.delinearizeEnabled !== false,
830
+ recallConfidenceGateEnabled: cfg.recallConfidenceGateEnabled === true,
831
+ recallConfidenceGateThreshold: typeof cfg.recallConfidenceGateThreshold === "number" ? Math.max(0, Math.min(1, cfg.recallConfidenceGateThreshold)) : 0.12,
832
+ causalRuleExtractionEnabled: cfg.causalRuleExtractionEnabled === true,
833
+ memoryReconstructionEnabled: cfg.memoryReconstructionEnabled === true,
834
+ memoryReconstructionMaxExpansions: typeof cfg.memoryReconstructionMaxExpansions === "number" ? Math.max(0, Math.round(cfg.memoryReconstructionMaxExpansions)) : 3,
835
+ graphLateralInhibitionEnabled: cfg.graphLateralInhibitionEnabled !== false,
836
+ graphLateralInhibitionBeta: typeof cfg.graphLateralInhibitionBeta === "number" ? Math.max(0, Math.min(1, cfg.graphLateralInhibitionBeta)) : 0.15,
837
+ graphLateralInhibitionTopM: typeof cfg.graphLateralInhibitionTopM === "number" ? Math.max(0, Math.round(cfg.graphLateralInhibitionTopM)) : 7,
838
+ // v8.2: Temporal Memory Tree
839
+ temporalMemoryTreeEnabled: cfg.temporalMemoryTreeEnabled === true,
840
+ tmtHourlyMinMemories: typeof cfg.tmtHourlyMinMemories === "number" ? cfg.tmtHourlyMinMemories : 3,
841
+ tmtSummaryMaxTokens: typeof cfg.tmtSummaryMaxTokens === "number" ? cfg.tmtSummaryMaxTokens : 300,
842
+ // Lossless Context Management (LCM)
843
+ lcmEnabled: cfg.lcmEnabled === true,
844
+ lcmLeafBatchSize: typeof cfg.lcmLeafBatchSize === "number" ? Math.max(2, Math.floor(cfg.lcmLeafBatchSize)) : 8,
845
+ lcmRollupFanIn: typeof cfg.lcmRollupFanIn === "number" ? Math.max(2, Math.floor(cfg.lcmRollupFanIn)) : 4,
846
+ lcmFreshTailTurns: typeof cfg.lcmFreshTailTurns === "number" ? Math.max(1, Math.floor(cfg.lcmFreshTailTurns)) : 16,
847
+ lcmMaxDepth: typeof cfg.lcmMaxDepth === "number" ? Math.max(1, Math.floor(cfg.lcmMaxDepth)) : 5,
848
+ lcmRecallBudgetShare: typeof cfg.lcmRecallBudgetShare === "number" ? Math.max(0, Math.min(1, cfg.lcmRecallBudgetShare)) : 0.15,
849
+ lcmDeterministicMaxTokens: typeof cfg.lcmDeterministicMaxTokens === "number" ? Math.max(64, Math.floor(cfg.lcmDeterministicMaxTokens)) : 512,
850
+ lcmArchiveRetentionDays: typeof cfg.lcmArchiveRetentionDays === "number" ? Math.max(1, Math.floor(cfg.lcmArchiveRetentionDays)) : 90,
851
+ // v9.1 Parallel Specialized Retrieval
852
+ parallelRetrievalEnabled: cfg.parallelRetrievalEnabled === true,
853
+ parallelAgentWeights: (() => {
854
+ const w = cfg.parallelAgentWeights;
855
+ return {
856
+ direct: typeof w?.direct === "number" ? Math.max(0, w.direct) : 1,
857
+ contextual: typeof w?.contextual === "number" ? Math.max(0, w.contextual) : 0.7,
858
+ temporal: typeof w?.temporal === "number" ? Math.max(0, w.temporal) : 0.85
859
+ };
860
+ })(),
861
+ parallelMaxResultsPerAgent: typeof cfg.parallelMaxResultsPerAgent === "number" ? Math.max(0, Math.floor(cfg.parallelMaxResultsPerAgent)) : 20
862
+ };
863
+ }
864
+ function clampNonNegativeNumber(value) {
865
+ if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
866
+ return Math.max(0, Math.floor(value));
867
+ }
868
+ function parseRecallSectionEntry(raw) {
869
+ const entry = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
870
+ return {
871
+ id: typeof entry.id === "string" ? entry.id.trim() : "",
872
+ enabled: entry.enabled !== false,
873
+ maxChars: entry.maxChars === null ? null : clampNonNegativeNumber(entry.maxChars),
874
+ maxHints: clampNonNegativeNumber(entry.maxHints),
875
+ maxSupportingFacts: clampNonNegativeNumber(entry.maxSupportingFacts),
876
+ maxRelatedEntities: clampNonNegativeNumber(entry.maxRelatedEntities),
877
+ consolidateTriggerLines: clampNonNegativeNumber(entry.consolidateTriggerLines),
878
+ consolidateTargetLines: clampNonNegativeNumber(entry.consolidateTargetLines),
879
+ maxEntities: clampNonNegativeNumber(entry.maxEntities),
880
+ maxResults: clampNonNegativeNumber(entry.maxResults),
881
+ recentTurns: clampNonNegativeNumber(entry.recentTurns),
882
+ maxTurns: clampNonNegativeNumber(entry.maxTurns),
883
+ maxTokens: clampNonNegativeNumber(entry.maxTokens),
884
+ lookbackHours: clampNonNegativeNumber(entry.lookbackHours),
885
+ maxCount: clampNonNegativeNumber(entry.maxCount),
886
+ topK: clampNonNegativeNumber(entry.topK),
887
+ timeoutMs: clampNonNegativeNumber(entry.timeoutMs),
888
+ maxPatterns: clampNonNegativeNumber(entry.maxPatterns),
889
+ maxRubrics: clampNonNegativeNumber(entry.maxRubrics)
890
+ };
891
+ }
892
+ function buildDefaultRecallPipeline(cfg) {
893
+ return [
894
+ {
895
+ id: "shared-context",
896
+ enabled: cfg.sharedContextEnabled === true,
897
+ maxChars: typeof cfg.sharedContextMaxInjectChars === "number" ? Math.max(0, Math.floor(cfg.sharedContextMaxInjectChars)) : 4e3
898
+ },
899
+ {
900
+ id: "profile",
901
+ enabled: true,
902
+ consolidateTriggerLines: 100,
903
+ consolidateTargetLines: 50
904
+ },
905
+ {
906
+ id: "identity-continuity",
907
+ enabled: cfg.identityContinuityEnabled === true
908
+ },
909
+ {
910
+ id: "entity-retrieval",
911
+ enabled: cfg.entityRetrievalEnabled !== false,
912
+ maxChars: typeof cfg.entityRetrievalMaxChars === "number" ? Math.max(0, Math.floor(cfg.entityRetrievalMaxChars)) : 2400,
913
+ maxHints: typeof cfg.entityRetrievalMaxHints === "number" ? Math.max(0, Math.floor(cfg.entityRetrievalMaxHints)) : 2,
914
+ maxSupportingFacts: typeof cfg.entityRetrievalMaxSupportingFacts === "number" ? Math.max(0, Math.floor(cfg.entityRetrievalMaxSupportingFacts)) : 6,
915
+ maxRelatedEntities: typeof cfg.entityRetrievalMaxRelatedEntities === "number" ? Math.max(0, Math.floor(cfg.entityRetrievalMaxRelatedEntities)) : 3,
916
+ recentTurns: typeof cfg.entityRetrievalRecentTurns === "number" ? Math.max(0, Math.floor(cfg.entityRetrievalRecentTurns)) : 6
917
+ },
918
+ {
919
+ id: "knowledge-index",
920
+ enabled: cfg.knowledgeIndexEnabled !== false,
921
+ maxChars: typeof cfg.knowledgeIndexMaxChars === "number" ? Math.max(0, Math.floor(cfg.knowledgeIndexMaxChars)) : 4e3,
922
+ maxEntities: typeof cfg.knowledgeIndexMaxEntities === "number" ? Math.max(0, Math.floor(cfg.knowledgeIndexMaxEntities)) : 40
923
+ },
924
+ { id: "verbatim-artifacts", enabled: cfg.verbatimArtifactsEnabled === true },
925
+ { id: "memory-boxes", enabled: cfg.memoryBoxesEnabled === true },
926
+ { id: "temporal-memory-tree", enabled: cfg.temporalMemoryTreeEnabled === true },
927
+ { id: "lcm-compressed-history", enabled: cfg.lcmEnabled === true },
928
+ {
929
+ id: "objective-state",
930
+ enabled: cfg.objectiveStateRecallEnabled === true,
931
+ maxResults: 4,
932
+ maxChars: 1800
933
+ },
934
+ {
935
+ id: "causal-trajectories",
936
+ enabled: cfg.causalTrajectoryRecallEnabled === true,
937
+ maxResults: 3,
938
+ maxChars: 2200
939
+ },
940
+ {
941
+ id: "trust-zones",
942
+ enabled: cfg.trustZoneRecallEnabled === true,
943
+ maxResults: 3,
944
+ maxChars: 1800
945
+ },
946
+ {
947
+ id: "harmonic-retrieval",
948
+ enabled: cfg.harmonicRetrievalEnabled === true,
949
+ maxResults: 3,
950
+ maxChars: 2200
951
+ },
952
+ {
953
+ id: "verified-episodes",
954
+ enabled: cfg.verifiedRecallEnabled === true,
955
+ maxResults: 3,
956
+ maxChars: 1800
957
+ },
958
+ {
959
+ id: "verified-rules",
960
+ enabled: cfg.semanticRuleVerificationEnabled === true,
961
+ maxResults: 3,
962
+ maxChars: 1800
963
+ },
964
+ {
965
+ id: "work-products",
966
+ enabled: cfg.workProductRecallEnabled === true,
967
+ maxResults: 3,
968
+ maxChars: 1800
969
+ },
970
+ {
971
+ id: "memories",
972
+ enabled: true,
973
+ maxResults: typeof cfg.qmdMaxResults === "number" ? Math.max(0, Math.floor(cfg.qmdMaxResults)) : 8
974
+ },
975
+ {
976
+ id: "compression-guidelines",
977
+ enabled: cfg.compressionGuidelineLearningEnabled === true
978
+ },
979
+ {
980
+ id: "native-knowledge",
981
+ enabled: cfg.nativeKnowledge && typeof cfg.nativeKnowledge === "object" ? cfg.nativeKnowledge.enabled === true : false,
982
+ maxResults: cfg.nativeKnowledge && typeof cfg.nativeKnowledge === "object" && typeof cfg.nativeKnowledge.maxResults === "number" ? Math.max(0, Math.floor(cfg.nativeKnowledge.maxResults)) : 4,
983
+ maxChars: cfg.nativeKnowledge && typeof cfg.nativeKnowledge === "object" && typeof cfg.nativeKnowledge.maxChars === "number" ? Math.max(0, Math.floor(cfg.nativeKnowledge.maxChars)) : 2400
984
+ },
985
+ {
986
+ id: "transcript",
987
+ enabled: cfg.transcriptEnabled !== false,
988
+ maxTurns: typeof cfg.maxTranscriptTurns === "number" ? Math.max(0, Math.floor(cfg.maxTranscriptTurns)) : 50,
989
+ maxTokens: typeof cfg.maxTranscriptTokens === "number" ? Math.max(0, Math.floor(cfg.maxTranscriptTokens)) : 1e3,
990
+ lookbackHours: typeof cfg.transcriptRecallHours === "number" ? Math.max(0, Math.floor(cfg.transcriptRecallHours)) : 12
991
+ },
992
+ {
993
+ id: "summaries",
994
+ enabled: cfg.hourlySummariesEnabled !== false,
995
+ maxCount: typeof cfg.maxSummaryCount === "number" ? Math.max(0, Math.floor(cfg.maxSummaryCount)) : 6,
996
+ lookbackHours: typeof cfg.summaryRecallHours === "number" ? Math.max(0, Math.floor(cfg.summaryRecallHours)) : 24
997
+ },
998
+ {
999
+ id: "conversation-recall",
1000
+ enabled: cfg.conversationIndexEnabled === true,
1001
+ topK: typeof cfg.conversationRecallTopK === "number" ? Math.max(0, Math.floor(cfg.conversationRecallTopK)) : 3,
1002
+ maxChars: typeof cfg.conversationRecallMaxChars === "number" ? Math.max(0, Math.floor(cfg.conversationRecallMaxChars)) : 2500,
1003
+ timeoutMs: typeof cfg.conversationRecallTimeoutMs === "number" ? Math.max(0, Math.floor(cfg.conversationRecallTimeoutMs)) : 800
1004
+ },
1005
+ {
1006
+ id: "compounding",
1007
+ enabled: cfg.compoundingEnabled === true && cfg.compoundingInjectEnabled !== false,
1008
+ maxPatterns: 40,
1009
+ maxRubrics: 4
1010
+ },
1011
+ { id: "questions", enabled: cfg.injectQuestions === true }
1012
+ ];
1013
+ }
1014
+ function buildRecallPipelineConfig(cfg) {
1015
+ const maxMemoryTokens = typeof cfg.maxMemoryTokens === "number" ? Math.max(0, Math.floor(cfg.maxMemoryTokens)) : 2e3;
1016
+ const recallBudgetCharsRaw = clampNonNegativeNumber(cfg.recallBudgetChars);
1017
+ const recallBudgetChars = recallBudgetCharsRaw ?? maxMemoryTokens * 4;
1018
+ const rawPipeline = cfg.recallPipeline;
1019
+ const pipeline = Array.isArray(rawPipeline) ? rawPipeline.map(parseRecallSectionEntry).filter((entry) => entry.id.length > 0) : buildDefaultRecallPipeline(cfg);
1020
+ return { recallBudgetChars, pipeline };
1021
+ }
1022
+
1023
+ export {
1024
+ VALID_MEMORY_CATEGORIES,
1025
+ parseConfig
1026
+ };
1027
+ //# sourceMappingURL=chunk-ISY75RLM.js.map