shieldcortex 4.12.14 → 4.13.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 (386) hide show
  1. package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
  2. package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
  3. package/dashboard/.next/standalone/dashboard/.next/prerender-manifest.json +3 -3
  4. package/dashboard/.next/standalone/dashboard/.next/required-server-files.json +4 -4
  5. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/admin/page.js +1 -1
  6. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/admin/page.js.nft.json +1 -1
  7. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/admin/page_client-reference-manifest.js +1 -1
  8. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/cloud/page.js +1 -1
  9. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/cloud/page.js.nft.json +1 -1
  10. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/cloud/page_client-reference-manifest.js +1 -1
  11. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/capture/page.js +1 -1
  12. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/capture/page.js.nft.json +1 -1
  13. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/capture/page_client-reference-manifest.js +1 -1
  14. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/graph/page.js +1 -1
  15. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/graph/page.js.nft.json +1 -1
  16. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/graph/page_client-reference-manifest.js +1 -1
  17. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/page.js +1 -1
  18. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/page.js.nft.json +1 -1
  19. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
  20. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/recall/page.js +1 -1
  21. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/recall/page.js.nft.json +1 -1
  22. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/recall/page_client-reference-manifest.js +1 -1
  23. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/review/page.js +1 -1
  24. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/review/page.js.nft.json +1 -1
  25. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/review/page_client-reference-manifest.js +1 -1
  26. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/timeline/page.js +1 -1
  27. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/timeline/page.js.nft.json +1 -1
  28. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/timeline/page_client-reference-manifest.js +1 -1
  29. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/overview/page.js +1 -1
  30. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/overview/page.js.nft.json +1 -1
  31. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/overview/page_client-reference-manifest.js +1 -1
  32. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/audit/page.js +1 -1
  33. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/audit/page.js.nft.json +1 -1
  34. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/audit/page_client-reference-manifest.js +1 -1
  35. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/intercepts/page.js +1 -1
  36. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/intercepts/page.js.nft.json +1 -1
  37. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/intercepts/page_client-reference-manifest.js +1 -1
  38. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/iron-dome/page.js +1 -1
  39. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/iron-dome/page.js.nft.json +1 -1
  40. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/iron-dome/page_client-reference-manifest.js +1 -1
  41. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/page.js +1 -1
  42. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/page.js.nft.json +1 -1
  43. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/page_client-reference-manifest.js +1 -1
  44. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/policies/page.js +1 -1
  45. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/policies/page.js.nft.json +1 -1
  46. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/policies/page_client-reference-manifest.js +1 -1
  47. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/quarantine/page.js +1 -1
  48. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/quarantine/page.js.nft.json +1 -1
  49. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/quarantine/page_client-reference-manifest.js +1 -1
  50. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/settings/page.js +1 -1
  51. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  52. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  53. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/page.js +1 -1
  54. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/page.js.nft.json +1 -1
  55. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/page_client-reference-manifest.js +1 -1
  56. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/xray/page.js +1 -1
  57. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/xray/page.js.nft.json +1 -1
  58. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/xray/page_client-reference-manifest.js +1 -1
  59. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/xray/page.js +1 -1
  60. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/xray/page.js.nft.json +1 -1
  61. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/xray/page_client-reference-manifest.js +1 -1
  62. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error/page.js.nft.json +1 -1
  63. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  64. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
  65. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
  66. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  67. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  68. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  69. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  70. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  71. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page.js.nft.json +1 -1
  72. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  73. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
  74. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +2 -2
  75. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  76. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  77. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  78. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  79. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  80. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  81. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.html +1 -1
  82. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.rsc +17 -15
  83. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk/admin/__PAGE__.segment.rsc +1 -1
  84. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk/admin.segment.rsc +1 -1
  85. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  86. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_full.segment.rsc +17 -15
  87. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_head.segment.rsc +1 -1
  88. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_index.segment.rsc +2 -2
  89. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_tree.segment.rsc +2 -2
  90. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.html +1 -1
  91. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.rsc +17 -15
  92. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk/cloud/__PAGE__.segment.rsc +1 -1
  93. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk/cloud.segment.rsc +1 -1
  94. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  95. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_full.segment.rsc +17 -15
  96. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_head.segment.rsc +1 -1
  97. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_index.segment.rsc +2 -2
  98. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_tree.segment.rsc +2 -2
  99. package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
  100. package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +2 -2
  101. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  102. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +2 -2
  103. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
  104. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +2 -2
  105. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  106. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.html +1 -1
  107. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.rsc +17 -15
  108. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory/capture/__PAGE__.segment.rsc +1 -1
  109. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory/capture.segment.rsc +1 -1
  110. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  111. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  112. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_full.segment.rsc +17 -15
  113. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_head.segment.rsc +1 -1
  114. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_index.segment.rsc +2 -2
  115. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_tree.segment.rsc +2 -2
  116. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.html +1 -1
  117. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.rsc +17 -15
  118. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory/graph/__PAGE__.segment.rsc +1 -1
  119. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory/graph.segment.rsc +1 -1
  120. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  121. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  122. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_full.segment.rsc +17 -15
  123. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_head.segment.rsc +1 -1
  124. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_index.segment.rsc +2 -2
  125. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_tree.segment.rsc +2 -2
  126. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.html +1 -1
  127. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.rsc +17 -15
  128. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory/recall/__PAGE__.segment.rsc +1 -1
  129. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory/recall.segment.rsc +1 -1
  130. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  131. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  132. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_full.segment.rsc +17 -15
  133. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_head.segment.rsc +1 -1
  134. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_index.segment.rsc +2 -2
  135. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_tree.segment.rsc +2 -2
  136. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.html +1 -1
  137. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.rsc +17 -15
  138. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory/review/__PAGE__.segment.rsc +1 -1
  139. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory/review.segment.rsc +1 -1
  140. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  141. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  142. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_full.segment.rsc +17 -15
  143. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_head.segment.rsc +1 -1
  144. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_index.segment.rsc +2 -2
  145. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_tree.segment.rsc +2 -2
  146. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.html +1 -1
  147. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.rsc +17 -15
  148. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory/timeline/__PAGE__.segment.rsc +1 -1
  149. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory/timeline.segment.rsc +1 -1
  150. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  151. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  152. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_full.segment.rsc +17 -15
  153. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_head.segment.rsc +1 -1
  154. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_index.segment.rsc +2 -2
  155. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_tree.segment.rsc +2 -2
  156. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.html +1 -1
  157. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.rsc +21 -18
  158. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk/memory/__PAGE__.segment.rsc +2 -2
  159. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  160. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  161. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_full.segment.rsc +21 -18
  162. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_head.segment.rsc +1 -1
  163. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_index.segment.rsc +2 -2
  164. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_tree.segment.rsc +2 -2
  165. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.html +1 -1
  166. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.rsc +20 -18
  167. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk/overview/__PAGE__.segment.rsc +2 -2
  168. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk/overview.segment.rsc +1 -1
  169. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  170. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_full.segment.rsc +20 -18
  171. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_head.segment.rsc +1 -1
  172. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_index.segment.rsc +2 -2
  173. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_tree.segment.rsc +2 -2
  174. package/dashboard/.next/standalone/dashboard/.next/server/app/page.js.nft.json +1 -1
  175. package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  176. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.html +1 -1
  177. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.rsc +17 -15
  178. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection/audit/__PAGE__.segment.rsc +1 -1
  179. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection/audit.segment.rsc +1 -1
  180. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  181. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  182. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_full.segment.rsc +17 -15
  183. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_head.segment.rsc +1 -1
  184. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_index.segment.rsc +2 -2
  185. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_tree.segment.rsc +2 -2
  186. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.html +1 -1
  187. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.rsc +17 -15
  188. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection/intercepts/__PAGE__.segment.rsc +1 -1
  189. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection/intercepts.segment.rsc +1 -1
  190. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  191. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  192. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_full.segment.rsc +17 -15
  193. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_head.segment.rsc +1 -1
  194. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_index.segment.rsc +2 -2
  195. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_tree.segment.rsc +2 -2
  196. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.html +1 -1
  197. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.rsc +17 -15
  198. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection/iron-dome/__PAGE__.segment.rsc +1 -1
  199. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection/iron-dome.segment.rsc +1 -1
  200. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  201. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  202. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_full.segment.rsc +17 -15
  203. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_head.segment.rsc +1 -1
  204. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_index.segment.rsc +2 -2
  205. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_tree.segment.rsc +2 -2
  206. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.html +1 -1
  207. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.rsc +17 -15
  208. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection/policies/__PAGE__.segment.rsc +1 -1
  209. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection/policies.segment.rsc +1 -1
  210. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  211. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  212. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_full.segment.rsc +17 -15
  213. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_head.segment.rsc +1 -1
  214. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_index.segment.rsc +2 -2
  215. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_tree.segment.rsc +2 -2
  216. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.html +1 -1
  217. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.rsc +17 -15
  218. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection/quarantine/__PAGE__.segment.rsc +1 -1
  219. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection/quarantine.segment.rsc +1 -1
  220. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  221. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  222. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_full.segment.rsc +17 -15
  223. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_head.segment.rsc +1 -1
  224. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_index.segment.rsc +2 -2
  225. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_tree.segment.rsc +2 -2
  226. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.html +1 -1
  227. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.rsc +17 -15
  228. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk/protection/__PAGE__.segment.rsc +2 -2
  229. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  230. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  231. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_full.segment.rsc +17 -15
  232. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_head.segment.rsc +1 -1
  233. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_index.segment.rsc +2 -2
  234. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_tree.segment.rsc +2 -2
  235. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.html +1 -1
  236. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.rsc +17 -15
  237. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings/__PAGE__.segment.rsc +2 -2
  238. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings.segment.rsc +1 -1
  239. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  240. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_full.segment.rsc +17 -15
  241. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  242. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  243. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  244. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.html +1 -1
  245. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.rsc +17 -15
  246. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain/xray/__PAGE__.segment.rsc +1 -1
  247. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain/xray.segment.rsc +1 -1
  248. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain.segment.rsc +1 -1
  249. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  250. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_full.segment.rsc +17 -15
  251. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_head.segment.rsc +1 -1
  252. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_index.segment.rsc +2 -2
  253. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_tree.segment.rsc +2 -2
  254. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.html +1 -1
  255. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.rsc +17 -15
  256. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk/supply-chain/__PAGE__.segment.rsc +1 -1
  257. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk/supply-chain.segment.rsc +1 -1
  258. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  259. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_full.segment.rsc +17 -15
  260. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_head.segment.rsc +1 -1
  261. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_index.segment.rsc +2 -2
  262. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_tree.segment.rsc +2 -2
  263. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.html +1 -1
  264. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.rsc +17 -15
  265. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk/xray/__PAGE__.segment.rsc +2 -2
  266. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk/xray.segment.rsc +1 -1
  267. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk.segment.rsc +9 -7
  268. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_full.segment.rsc +17 -15
  269. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_head.segment.rsc +1 -1
  270. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_index.segment.rsc +2 -2
  271. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_tree.segment.rsc +2 -2
  272. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/9f1d4_@tanstack_68dcbde9._.js +3 -0
  273. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__fb5796ae._.js → [root-of-the-server]__2de25d56._.js} +2 -2
  274. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/[root-of-the-server]__52bd7a9f._.js +3 -0
  275. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__b789489c._.js → [root-of-the-server]__6f881a23._.js} +2 -2
  276. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_01f6ceb0._.js +1 -1
  277. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_20c6acea._.js +3 -0
  278. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/{9f1d4_next_c9fe89e1._.js → dashboard_25b568c3._.js} +2 -2
  279. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_2a8eef6b._.js +3 -0
  280. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_35a9932a._.js +1 -1
  281. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_37f17371._.js +1 -1
  282. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_77cb2b63._.js +3 -0
  283. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_91003e6d._.js +3 -0
  284. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_9b8695d8._.js +3 -0
  285. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_a16ef10a._.js +3 -0
  286. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_c219bf07._.js +4 -4
  287. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_f9cd1dc2._.js +3 -0
  288. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_fefd3b85._.js +1 -1
  289. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_44a9f72c._.js +3 -0
  290. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_de7ac4f9._.js +3 -0
  291. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_protection_ProtectionOverview_tsx_54554a97._.js +3 -3
  292. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_settings_SettingsView_tsx_16dc83a7._.js +1 -1
  293. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_xray_XRayOverview_tsx_ceba698e._.js +1 -1
  294. package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
  295. package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
  296. package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.js +1 -1
  297. package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.json +1 -1
  298. package/dashboard/.next/standalone/dashboard/.next/static/chunks/015dc64369f26b7d.css +3 -0
  299. package/dashboard/.next/standalone/dashboard/.next/static/chunks/2fe84829530e61a3.js +1 -0
  300. package/dashboard/.next/standalone/dashboard/.next/static/chunks/34d0309a4e34b084.js +1 -0
  301. package/dashboard/.next/standalone/dashboard/.next/static/chunks/3729c748a4361c1f.js +1 -0
  302. package/dashboard/.next/standalone/dashboard/.next/static/chunks/3b7fdf1ee828254c.js +1 -0
  303. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{3d53807a9a943ce7.js → 4c90ebd2c08cd656.js} +4 -4
  304. package/dashboard/.next/standalone/dashboard/.next/static/chunks/4d4af0cecaef56f2.js +1 -0
  305. package/dashboard/.next/standalone/dashboard/.next/static/chunks/4eb86dc2f379d3ca.js +1 -0
  306. package/dashboard/.next/standalone/dashboard/.next/static/chunks/6aba18b7aac42ccd.js +1 -0
  307. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{b4b3fb5729bead7e.js → 6ea97c8dc9e30ea5.js} +1 -1
  308. package/dashboard/.next/standalone/dashboard/.next/static/chunks/74ea1a87751e93a3.js +1 -0
  309. package/dashboard/.next/standalone/dashboard/.next/static/chunks/910628c23329a773.js +1 -0
  310. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{c288964c4c00982a.js → b308a787e8cbc2a9.js} +3 -3
  311. package/dashboard/.next/standalone/dashboard/.next/static/chunks/bdb50889a1c1ab37.js +1 -0
  312. package/dashboard/.next/standalone/dashboard/.next/static/chunks/d0bf5ccba09917dd.js +1 -0
  313. package/dashboard/.next/standalone/dashboard/.next/static/chunks/e804a1fda2839550.js +1 -0
  314. package/dashboard/.next/standalone/dashboard/server.js +1 -1
  315. package/dist/api/routes/digest.d.ts +59 -0
  316. package/dist/api/routes/digest.js +305 -0
  317. package/dist/api/routes/memories.js +84 -15
  318. package/dist/api/routes/system.js +10 -2
  319. package/dist/api/visualization-server.js +2 -0
  320. package/dist/cli/doctor.d.ts +27 -0
  321. package/dist/cli/doctor.js +88 -0
  322. package/dist/cli/migrate-legacy.d.ts +28 -0
  323. package/dist/cli/migrate-legacy.js +291 -0
  324. package/dist/cloud/cli.js +2 -2
  325. package/dist/database/init.js +26 -1
  326. package/dist/index.js +8 -1
  327. package/dist/memory/backup.d.ts +19 -0
  328. package/dist/memory/backup.js +47 -0
  329. package/dist/memory/dedupe-runner.d.ts +33 -0
  330. package/dist/memory/dedupe-runner.js +103 -0
  331. package/dist/memory/fts.d.ts +26 -0
  332. package/dist/memory/fts.js +59 -0
  333. package/dist/memory/lifecycle.d.ts +83 -0
  334. package/dist/memory/lifecycle.js +274 -0
  335. package/dist/memory/links.d.ts +63 -0
  336. package/dist/memory/links.js +232 -0
  337. package/dist/memory/prune.d.ts +34 -0
  338. package/dist/memory/prune.js +76 -0
  339. package/dist/memory/search-recall.d.ts +48 -0
  340. package/dist/memory/search-recall.js +367 -0
  341. package/dist/memory/store.d.ts +6 -121
  342. package/dist/memory/store.js +45 -854
  343. package/dist/setup/claude-md.d.ts +1 -0
  344. package/dist/setup/deep-clean.d.ts +33 -0
  345. package/dist/setup/deep-clean.js +26 -0
  346. package/dist/setup/doctor.js +7 -2
  347. package/dist/setup/settings-hooks.d.ts +1 -0
  348. package/dist/setup/settings-hooks.js +30 -5
  349. package/dist/setup/status.js +39 -0
  350. package/hooks/openclaw/cortex-memory/runtime.mjs +18 -4
  351. package/package.json +1 -1
  352. package/plugins/openclaw/dist/index.js +12 -6
  353. package/plugins/openclaw/dist/openclaw.plugin.json +1 -1
  354. package/scripts/lib/auto-memory-config.mjs +45 -0
  355. package/scripts/lib/telemetry.mjs +58 -0
  356. package/scripts/lib/transcript-reader.mjs +123 -0
  357. package/scripts/postinstall.mjs +47 -1
  358. package/scripts/pre-compact-hook.mjs +76 -124
  359. package/scripts/session-end-hook.mjs +102 -97
  360. package/scripts/stop-hook.mjs +346 -116
  361. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/9f1d4_@tanstack_785e068c._.js +0 -3
  362. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/[root-of-the-server]__c2b92077._.js +0 -3
  363. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_11878109._.js +0 -3
  364. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_35c9f22e._.js +0 -3
  365. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_836b4a04._.js +0 -3
  366. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_9770c429._.js +0 -3
  367. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_9dd626ed._.js +0 -3
  368. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_e94d2da2._.js +0 -3
  369. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_564ea5ae._.js +0 -3
  370. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_lib_3f1490a1._.js +0 -3
  371. package/dashboard/.next/standalone/dashboard/.next/static/chunks/079a5be036130e37.js +0 -1
  372. package/dashboard/.next/standalone/dashboard/.next/static/chunks/1770a8ce7abb2437.js +0 -1
  373. package/dashboard/.next/standalone/dashboard/.next/static/chunks/1a074f8ddc7cd385.js +0 -1
  374. package/dashboard/.next/standalone/dashboard/.next/static/chunks/24da99d1341bd573.css +0 -3
  375. package/dashboard/.next/standalone/dashboard/.next/static/chunks/2aa8afb655c1c2e5.js +0 -1
  376. package/dashboard/.next/standalone/dashboard/.next/static/chunks/302ad459a0e5c4ba.js +0 -1
  377. package/dashboard/.next/standalone/dashboard/.next/static/chunks/385ec610bad1acc5.js +0 -1
  378. package/dashboard/.next/standalone/dashboard/.next/static/chunks/4f57582c2d186438.js +0 -1
  379. package/dashboard/.next/standalone/dashboard/.next/static/chunks/52843253e4b833a5.js +0 -1
  380. package/dashboard/.next/standalone/dashboard/.next/static/chunks/7fca141efba9d353.js +0 -1
  381. package/dashboard/.next/standalone/dashboard/.next/static/chunks/8593e1796c9d043d.js +0 -1
  382. package/dashboard/.next/standalone/dashboard/.next/static/chunks/cbc2e6ffcad6e91c.js +0 -1
  383. package/dashboard/.next/standalone/dashboard/.next/static/chunks/fced7dd3c9874ed1.js +0 -1
  384. /package/dashboard/.next/standalone/dashboard/.next/static/{P2sW3M-qHaW9VS9YwCEg3 → kiA_iEHG_1wWOEYFsD0Tj}/_buildManifest.js +0 -0
  385. /package/dashboard/.next/standalone/dashboard/.next/static/{P2sW3M-qHaW9VS9YwCEg3 → kiA_iEHG_1wWOEYFsD0Tj}/_clientMiddlewareManifest.json +0 -0
  386. /package/dashboard/.next/standalone/dashboard/.next/static/{P2sW3M-qHaW9VS9YwCEg3 → kiA_iEHG_1wWOEYFsD0Tj}/_ssgManifest.js +0 -0
@@ -8,11 +8,9 @@ import { randomUUID } from 'crypto';
8
8
  import { getDatabase, isDatabaseInitialized, withTransaction } from '../database/init.js';
9
9
  import { DEFAULT_CONFIG, } from './types.js';
10
10
  import { calculateSalience, suggestCategory, extractTags, } from './salience.js';
11
- import { calculateDecayedScore, calculateReinforcementBoost, calculatePriority, } from './decay.js';
12
- import { activateMemory as spreadActivation, getActivationBoost, pruneActivationCache, } from './activation.js';
13
- import { jaccardSimilarity } from './similarity.js';
14
- import { emitMemoryCreated, emitMemoryAccessed, emitMemoryDeleted, emitMemoryUpdated, persistEvent, } from '../api/events.js';
15
- import { generateEmbedding, cosineSimilarity } from '../embeddings/index.js';
11
+ import { calculateDecayedScore } from './decay.js';
12
+ import { emitMemoryCreated, emitMemoryDeleted, emitMemoryUpdated, persistEvent, } from '../api/events.js';
13
+ import { generateEmbedding } from '../embeddings/index.js';
16
14
  import { isPaused } from '../api/control.js';
17
15
  import { extractFromMemory } from '../graph/extract.js';
18
16
  import { processExtractionResult, removeMemoryGraph, replaceMemoryGraph } from '../graph/resolve.js';
@@ -25,10 +23,15 @@ import { checkAccess } from '../defence/trust/access-control.js';
25
23
  import { scoreSource } from '../defence/trust/source-scorer.js';
26
24
  import { logAudit } from '../defence/audit/logger.js';
27
25
  import { dispatchWebhook } from '../events/webhooks.js';
28
- import { getCachedQueryEmbedding, findSimilarMemories } from './embedding.js';
29
- import { buildSearchExplanation, calculateLinkBoost, calculateTagScore, detectQueryCategory, extractQueryTags, vectorSearch, } from './search.js';
30
- // Anti-bloat: Maximum content size per memory (10KB)
31
- const MAX_CONTENT_SIZE = 10 * 1024;
26
+ import { safeJsonParse } from './fts.js';
27
+ // Internal use of the link API. links.ts also imports from store.ts (getMemoryById,
28
+ // rowToMemory) the cycle is safe because both directions only invoke the imported
29
+ // symbols inside function bodies, never at module load. ESM live bindings handle it.
30
+ // Same function-body-only cycle pattern applies to lifecycle.ts and search-recall.ts.
31
+ import { createMemoryLink, detectRelationships } from './links.js';
32
+ // Anti-bloat: Maximum content size per memory (10KB).
33
+ // Exported because lifecycle.ts also enforces this budget inside enrichMemory.
34
+ export const MAX_CONTENT_SIZE = 10 * 1024;
32
35
  // Track truncation info globally for the last addMemory call
33
36
  let lastTruncationInfo = null;
34
37
  /**
@@ -67,61 +70,6 @@ function truncateContent(content) {
67
70
  export function getLastTruncationInfo() {
68
71
  return lastTruncationInfo;
69
72
  }
70
- /**
71
- * Escape FTS5 query to prevent syntax errors
72
- * FTS5 interprets:
73
- * - "word-word" as "column:value" syntax
74
- * - AND, OR, NOT as boolean operators
75
- * - &, | as boolean operators
76
- * We quote individual terms to search them literally
77
- */
78
- function escapeFts5Query(query) {
79
- // Split on whitespace, process each term, filter empty, rejoin
80
- return query
81
- .split(/\s+/)
82
- .filter(term => term.length > 0)
83
- .map(term => {
84
- // Replace apostrophes with spaces — FTS5 porter unicode61 tokenizer treats
85
- // apostrophes as word separators during indexing ("don't" → "don" + "t").
86
- // We must split the same way so queries match the indexed tokens.
87
- if (term.includes("'")) {
88
- const parts = term.split("'").filter(p => p.length > 0);
89
- // Recursively escape each part and join with spaces
90
- return parts.map(p => {
91
- if (/[^a-zA-Z0-9_]/.test(p))
92
- return `"${p.replace(/"/g, '""')}"`;
93
- return p;
94
- }).join(' ');
95
- }
96
- // FTS5 boolean operators - quote them to search literally
97
- const upperTerm = term.toUpperCase();
98
- if (upperTerm === 'AND' || upperTerm === 'OR' || upperTerm === 'NOT') {
99
- return `"${term}"`;
100
- }
101
- // If term contains special FTS5 characters, quote it
102
- // Including: - : * ^ ( ) & | . , ; ! ? and quotes
103
- if (/[^a-zA-Z0-9_]/.test(term)) {
104
- // Escape existing quotes and wrap in quotes
105
- return `"${term.replace(/"/g, '""')}"`;
106
- }
107
- return term;
108
- })
109
- .filter(Boolean)
110
- .join(' ');
111
- }
112
- /**
113
- * Safely parse JSON with fallback — prevents corrupted DB values from crashing queries
114
- */
115
- function safeJsonParse(value, fallback) {
116
- if (!value)
117
- return fallback;
118
- try {
119
- return JSON.parse(value);
120
- }
121
- catch {
122
- return fallback;
123
- }
124
- }
125
73
  function inferSourceDetails(input, source) {
126
74
  const tags = (input.tags ?? []).map((tag) => tag.toLowerCase());
127
75
  const metadata = input.metadata ?? {};
@@ -260,7 +208,9 @@ function checkRateLimit(source) {
260
208
  }
261
209
  }
262
210
  // ── Read-Time Access Control ──
263
- function logAccessDenial(memoryId, source, reason) {
211
+ // Exported because search-recall.ts also calls logAccessDenial inside its
212
+ // post-search ACL filter (cycle artifact, not intended public API).
213
+ export function logAccessDenial(memoryId, source, reason) {
264
214
  const trust = scoreSource(source).score;
265
215
  logAudit({
266
216
  memory_id: memoryId,
@@ -826,547 +776,6 @@ export function deleteMemory(id, source) {
826
776
  }
827
777
  return result.changes > 0;
828
778
  }
829
- /**
830
- * Access a memory (updates access count and timestamp, returns reinforced memory)
831
- */
832
- export function accessMemory(id, config = DEFAULT_CONFIG, source) {
833
- const db = getDatabase();
834
- const memory = getMemoryById(id, source);
835
- if (!memory)
836
- return null;
837
- // Calculate new salience with reinforcement
838
- const newSalience = calculateReinforcementBoost(memory, config);
839
- db.prepare(`
840
- UPDATE memories
841
- SET access_count = access_count + 1,
842
- last_accessed = CURRENT_TIMESTAMP,
843
- salience = ?
844
- WHERE id = ?
845
- `).run(newSalience, id);
846
- const updatedMemory = getMemoryById(id);
847
- // Emit event for real-time dashboard (in-process)
848
- emitMemoryAccessed(updatedMemory, newSalience);
849
- // Persist event for cross-process IPC (MCP → Dashboard)
850
- persistEvent('memory_accessed', { memoryId: id, memory: updatedMemory, newSalience });
851
- // ORGANIC FEATURE: Link strengthening on co-access
852
- // If memory A and B are both accessed within 5 minutes, strengthen their link
853
- // This mimics Hebbian learning: "neurons that fire together, wire together"
854
- try {
855
- const recentlyAccessed = db.prepare(`
856
- SELECT id FROM memories
857
- WHERE last_accessed > datetime('now', '-5 minutes')
858
- AND id != ?
859
- LIMIT 10
860
- `).all(id);
861
- for (const recent of recentlyAccessed) {
862
- // Check if link exists in either direction
863
- const existingLink = db.prepare(`
864
- SELECT id, strength FROM memory_links
865
- WHERE (source_id = ? AND target_id = ?) OR (source_id = ? AND target_id = ?)
866
- `).get(id, recent.id, recent.id, id);
867
- if (existingLink) {
868
- // Strengthen existing link (cap at 1.0)
869
- const newStrength = Math.min(1.0, existingLink.strength + 0.05);
870
- db.prepare('UPDATE memory_links SET strength = ? WHERE id = ?')
871
- .run(newStrength, existingLink.id);
872
- }
873
- else {
874
- // Create new weak link for co-accessed memories
875
- createMemoryLink(id, recent.id, 'related', 0.2);
876
- }
877
- }
878
- }
879
- catch (e) {
880
- // Don't fail memory access if link strengthening fails
881
- console.error('[shieldcortex] Link strengthening failed:', e);
882
- }
883
- // ORGANIC FEATURE: Spreading Activation (Phase 2)
884
- // Activate this memory and spread activation to linked memories
885
- // This makes related memories easier to recall in subsequent searches
886
- spreadActivation(id);
887
- return updatedMemory;
888
- }
889
- /**
890
- * Reinforce a memory that appeared in search results
891
- * Gives a small salience boost with diminishing returns based on access count.
892
- * ORGANIC FEATURE: Searched memories get reinforced, closing the feedback loop
893
- * so frequently-found memories grow stronger over time.
894
- */
895
- export function reinforceFromSearch(memoryId) {
896
- const db = getDatabase();
897
- const memory = db.prepare('SELECT salience, access_count FROM memories WHERE id = ?').get(memoryId);
898
- if (!memory)
899
- return;
900
- // Small salience boost per search appearance (diminishing returns)
901
- const boost = Math.max(0.005, 0.02 / (1 + memory.access_count * 0.1));
902
- const newSalience = Math.min(1.0, memory.salience + boost);
903
- db.prepare(`
904
- UPDATE memories
905
- SET last_accessed = CURRENT_TIMESTAMP,
906
- access_count = access_count + 1,
907
- salience = ?
908
- WHERE id = ?
909
- `).run(newSalience, memoryId);
910
- }
911
- // ============================================
912
- // ORGANIC FEATURE: Memory Enrichment (Phase 3)
913
- // ============================================
914
- // Enrichment configuration
915
- const ENRICHMENT_SIMILARITY_THRESHOLD = 0.3; // Min similarity to trigger enrichment
916
- const ENRICHMENT_COOLDOWN_HOURS = 1; // Don't enrich same memory within 1 hour
917
- const MAX_ENRICHMENT_SIZE = 2000; // Max chars to add per enrichment
918
- // Track last enrichment times (in-memory, ephemeral like activation cache)
919
- const enrichmentTimestamps = new Map();
920
- let enrichmentCallCount = 0;
921
- function pruneEnrichmentTimestamps() {
922
- const now = Date.now();
923
- const cooldownMs = ENRICHMENT_COOLDOWN_HOURS * 60 * 60 * 1000;
924
- for (const [memoryId, timestamp] of enrichmentTimestamps) {
925
- if (now - timestamp > cooldownMs) {
926
- enrichmentTimestamps.delete(memoryId);
927
- }
928
- }
929
- }
930
- /**
931
- * Enrich a memory with additional context
932
- *
933
- * This adds timestamped context to a memory when:
934
- * 1. The new context is sufficiently related but different (new information)
935
- * 2. The memory hasn't been enriched recently (cooldown)
936
- * 3. The content won't exceed the size limit
937
- *
938
- * ORGANIC FEATURE: Memories grow with new context over time,
939
- * mimicking how human memories are reconsolidated with new information
940
- *
941
- * @param memoryId - ID of the memory to enrich
942
- * @param newContext - New context to add
943
- * @param contextType - Type of context ('search' | 'access' | 'related')
944
- * @returns EnrichmentResult indicating success or failure with reason
945
- */
946
- export function enrichMemory(memoryId, newContext, contextType = 'access') {
947
- // Prune stale cooldown entries every 100 calls
948
- if (++enrichmentCallCount % 100 === 0) {
949
- pruneEnrichmentTimestamps();
950
- }
951
- const db = getDatabase();
952
- const memory = getMemoryById(memoryId);
953
- if (!memory) {
954
- return { enriched: false, reason: 'Memory not found' };
955
- }
956
- // Check cooldown
957
- const lastEnrichment = enrichmentTimestamps.get(memoryId);
958
- const now = Date.now();
959
- if (lastEnrichment && (now - lastEnrichment) < ENRICHMENT_COOLDOWN_HOURS * 60 * 60 * 1000) {
960
- return { enriched: false, reason: 'Enrichment cooldown active' };
961
- }
962
- // Check similarity - should be related but not too similar (new info)
963
- const similarity = jaccardSimilarity(memory.content, newContext);
964
- if (similarity > 0.8) {
965
- return { enriched: false, reason: 'Context too similar (no new information)' };
966
- }
967
- if (similarity < ENRICHMENT_SIMILARITY_THRESHOLD) {
968
- return { enriched: false, reason: 'Context not sufficiently related' };
969
- }
970
- // Truncate context if needed
971
- const truncatedContext = newContext.slice(0, MAX_ENRICHMENT_SIZE);
972
- // Build enrichment block with timestamp
973
- const timestamp = new Date().toISOString().split('T')[0]; // YYYY-MM-DD
974
- const enrichmentBlock = `\n\n---\n[${timestamp}] ${contextType}: ${truncatedContext}`;
975
- // Check size limit (leave 500 char buffer for future enrichments)
976
- const newContent = memory.content + enrichmentBlock;
977
- if (newContent.length > MAX_CONTENT_SIZE - 500) {
978
- return { enriched: false, reason: 'Content size limit reached' };
979
- }
980
- // Update memory
981
- db.prepare(`
982
- UPDATE memories
983
- SET content = ?,
984
- last_accessed = CURRENT_TIMESTAMP
985
- WHERE id = ?
986
- `).run(newContent, memoryId);
987
- // Update cooldown timestamp
988
- enrichmentTimestamps.set(memoryId, now);
989
- // Emit update event for dashboard
990
- const updatedMemory = getMemoryById(memoryId);
991
- emitMemoryUpdated(updatedMemory);
992
- return { enriched: true, reason: `Added ${contextType} context (${truncatedContext.length} chars)` };
993
- }
994
- /**
995
- * Clear enrichment cooldown for a memory (for testing)
996
- */
997
- export function clearEnrichmentCooldown(memoryId) {
998
- enrichmentTimestamps.delete(memoryId);
999
- }
1000
- /**
1001
- * Get enrichment cooldown status for a memory
1002
- */
1003
- export function getEnrichmentCooldownStatus(memoryId) {
1004
- const lastEnrichment = enrichmentTimestamps.get(memoryId);
1005
- if (!lastEnrichment) {
1006
- return { onCooldown: false, remainingMs: 0 };
1007
- }
1008
- const cooldownMs = ENRICHMENT_COOLDOWN_HOURS * 60 * 60 * 1000;
1009
- const elapsed = Date.now() - lastEnrichment;
1010
- const remaining = Math.max(0, cooldownMs - elapsed);
1011
- return {
1012
- onCooldown: remaining > 0,
1013
- remainingMs: remaining,
1014
- };
1015
- }
1016
- /**
1017
- * Update persisted decay scores for all memories
1018
- * Called during consolidation and periodically by the API server
1019
- * Returns the number of memories updated
1020
- */
1021
- export function updateDecayScores() {
1022
- const db = getDatabase();
1023
- // Get all memories
1024
- const memories = db.prepare('SELECT * FROM memories').all();
1025
- let updated = 0;
1026
- const updateStmt = db.prepare('UPDATE memories SET decayed_score = ? WHERE id = ?');
1027
- for (const row of memories) {
1028
- const memory = rowToMemory(row);
1029
- const decayedScore = calculateDecayedScore(memory);
1030
- // Only update if score has changed significantly (saves writes)
1031
- const currentScore = row.decayed_score;
1032
- if (currentScore === null || Math.abs(currentScore - decayedScore) > 0.01) {
1033
- updateStmt.run(decayedScore, memory.id);
1034
- updated++;
1035
- }
1036
- }
1037
- return updated;
1038
- }
1039
- async function searchMemoriesInternal(options, config, source, execution) {
1040
- if (++searchCount % 100 === 0) {
1041
- pruneActivationCache();
1042
- }
1043
- const db = getDatabase();
1044
- const limit = options.limit || 20;
1045
- const includeGlobal = options.includeGlobal ?? true;
1046
- const detectedCategory = options.query ? detectQueryCategory(options.query) : null;
1047
- const queryTags = options.query ? extractQueryTags(options.query) : [];
1048
- let queryEmbedding = null;
1049
- const vectorResults = new Map();
1050
- if (options.query && options.query.trim()) {
1051
- try {
1052
- queryEmbedding = await getCachedQueryEmbedding(options.query);
1053
- if (!queryEmbedding) {
1054
- throw new Error('query embedding unavailable');
1055
- }
1056
- const vectorHits = vectorSearch(db, rowToMemory, queryEmbedding, limit * 2, options.project, includeGlobal);
1057
- for (const hit of vectorHits) {
1058
- vectorResults.set(hit.memory.id, hit.similarity);
1059
- }
1060
- }
1061
- catch {
1062
- if (process.env.SHIELDCORTEX_SKIP_EMBEDDINGS !== '1') {
1063
- console.log('[shieldcortex] Vector search unavailable, using FTS only');
1064
- }
1065
- }
1066
- }
1067
- let sql;
1068
- const params = [];
1069
- if (options.query && options.query.trim()) {
1070
- const escapedQuery = escapeFts5Query(options.query.trim());
1071
- sql = `
1072
- SELECT m.*, fts.rank
1073
- FROM memories m
1074
- JOIN memories_fts fts ON m.id = fts.rowid
1075
- WHERE memories_fts MATCH ?
1076
- `;
1077
- params.push(escapedQuery);
1078
- }
1079
- else {
1080
- sql = `SELECT *, 0 as rank FROM memories m WHERE 1=1`;
1081
- }
1082
- if (options.project) {
1083
- if (includeGlobal) {
1084
- sql += ` AND (m.project = ? OR m.scope = 'global')`;
1085
- }
1086
- else {
1087
- sql += ' AND m.project = ?';
1088
- }
1089
- params.push(options.project);
1090
- }
1091
- if (options.category) {
1092
- sql += ' AND m.category = ?';
1093
- params.push(options.category);
1094
- }
1095
- if (options.type) {
1096
- sql += ' AND m.type = ?';
1097
- params.push(options.type);
1098
- }
1099
- if (!options.includeArchived) {
1100
- sql += ` AND m.status != 'archived'`;
1101
- }
1102
- if (!options.includeSuppressed) {
1103
- sql += ` AND m.status != 'suppressed'`;
1104
- }
1105
- if (options.minSalience) {
1106
- sql += ' AND m.salience >= ?';
1107
- params.push(options.minSalience);
1108
- }
1109
- if (options.tags && options.tags.length > 0) {
1110
- const tagPlaceholders = options.tags.map(() => '?').join(',');
1111
- sql += ` AND EXISTS (
1112
- SELECT 1 FROM json_each(m.tags)
1113
- WHERE json_each.value IN (${tagPlaceholders})
1114
- )`;
1115
- params.push(...options.tags);
1116
- }
1117
- sql += ' ORDER BY m.salience DESC, m.last_accessed DESC LIMIT ?';
1118
- params.push(limit);
1119
- const rows = db.prepare(sql).all(...params);
1120
- const scoringContext = {
1121
- db,
1122
- config,
1123
- detectedCategory,
1124
- queryTags,
1125
- vectorResults,
1126
- query: options.query,
1127
- };
1128
- const results = rows.map((row) => {
1129
- const memory = rowToMemory(row);
1130
- const decayedScore = calculateDecayedScore(memory, config);
1131
- memory.decayedScore = decayedScore;
1132
- const rawRank = row.rank;
1133
- const ftsScore = rawRank ? 1 / (1 + Math.abs(rawRank)) : 0.3;
1134
- const hoursSinceAccess = (Date.now() - new Date(memory.lastAccessed).getTime()) / (1000 * 60 * 60);
1135
- const recencyBoost = hoursSinceAccess < 1 ? 0.1 : (hoursSinceAccess < 24 ? 0.05 : 0);
1136
- const categoryBoost = detectedCategory && memory.category === detectedCategory ? 0.1 : 0;
1137
- const linkBoost = calculateLinkBoost(memory.id, db);
1138
- const tagBoost = calculateTagScore(queryTags, memory.tags);
1139
- const activationBoost = getActivationBoost(memory.id);
1140
- const vectorSimilarity = vectorResults.get(memory.id) || 0;
1141
- const vectorBoost = vectorSimilarity * 0.3;
1142
- const priorityBoost = calculatePriority(memory) * 0.05;
1143
- const contradictionCount = db.prepare(`SELECT COUNT(*) as count FROM memory_links WHERE relationship = 'contradicts' AND (source_id = ? OR target_id = ?)`).get(memory.id, memory.id).count;
1144
- const contradictionPenalty = Math.min(0.12, contradictionCount * 0.03);
1145
- const eligibilityReasons = [];
1146
- if (memory.status === 'archived')
1147
- eligibilityReasons.push('Archived memories are excluded from normal recall');
1148
- if (memory.status === 'suppressed')
1149
- eligibilityReasons.push('Suppressed memories are excluded from normal recall');
1150
- if (memory.cloudExcluded)
1151
- eligibilityReasons.push('Excluded from cloud sync');
1152
- if (memory.trustScore < 0.7)
1153
- eligibilityReasons.push(`Low trust source (${memory.trustScore.toFixed(2)})`);
1154
- if (contradictionCount > 0)
1155
- eligibilityReasons.push(`${contradictionCount} contradiction link${contradictionCount === 1 ? '' : 's'} attached`);
1156
- const relevanceScore = (ftsScore * 0.25 +
1157
- vectorBoost +
1158
- decayedScore * 0.2 +
1159
- priorityBoost +
1160
- recencyBoost + categoryBoost + linkBoost + tagBoost + activationBoost -
1161
- contradictionPenalty);
1162
- const result = {
1163
- memory,
1164
- relevanceScore,
1165
- recallEligibility: {
1166
- eligible: eligibilityReasons.length === 0,
1167
- reasons: eligibilityReasons,
1168
- },
1169
- };
1170
- if (execution.includeExplanation) {
1171
- result.explanation = buildSearchExplanation(memory, scoringContext, {
1172
- ftsScore,
1173
- vectorSimilarity,
1174
- vectorBoost,
1175
- decayedScore,
1176
- priorityBoost,
1177
- recencyBoost,
1178
- categoryBoost,
1179
- linkBoost,
1180
- tagBoost,
1181
- activationBoost,
1182
- contradictionPenalty,
1183
- finalScore: relevanceScore,
1184
- });
1185
- if (result.explanation) {
1186
- result.explanation.eligibility = result.recallEligibility;
1187
- }
1188
- }
1189
- return result;
1190
- });
1191
- const sortedResults = results
1192
- .filter((result) => options.includeDecayed || result.memory.decayedScore >= config.salienceThreshold)
1193
- .sort((a, b) => b.relevanceScore - a.relevanceScore);
1194
- if (execution.enableSideEffects) {
1195
- const topResults = sortedResults.slice(0, 5);
1196
- for (const result of topResults) {
1197
- reinforceFromSearch(result.memory.id);
1198
- }
1199
- if (topResults.length >= 2) {
1200
- for (let i = 0; i < topResults.length; i++) {
1201
- for (let j = i + 1; j < topResults.length; j++) {
1202
- const idA = topResults[i].memory.id;
1203
- const idB = topResults[j].memory.id;
1204
- const existing = db.prepare('SELECT strength FROM memory_links WHERE (source_id = ? AND target_id = ?) OR (source_id = ? AND target_id = ?)').get(idA, idB, idB, idA);
1205
- if (existing) {
1206
- const newStrength = Math.min(1.0, existing.strength + 0.03);
1207
- db.prepare('UPDATE memory_links SET strength = ? WHERE (source_id = ? AND target_id = ?) OR (source_id = ? AND target_id = ?)').run(newStrength, idA, idB, idB, idA);
1208
- }
1209
- else {
1210
- try {
1211
- db.prepare('INSERT INTO memory_links (source_id, target_id, relationship, strength) VALUES (?, ?, ?, ?)').run(idA, idB, 'related', 0.2);
1212
- }
1213
- catch (e) {
1214
- if (!(e instanceof Error && e.message.includes('UNIQUE constraint'))) {
1215
- console.warn('[shieldcortex] Unexpected error linking co-returned memories:', e);
1216
- }
1217
- }
1218
- }
1219
- }
1220
- }
1221
- }
1222
- if (sortedResults.length > 0 && options.query && options.query.length > 30) {
1223
- const topResult = sortedResults[0];
1224
- const queryWords = new Set(options.query.toLowerCase().split(/\s+/).filter(w => w.length > 3));
1225
- const contentWords = new Set(topResult.memory.content.toLowerCase().split(/\s+/));
1226
- const newWords = [...queryWords].filter(w => !contentWords.has(w));
1227
- if (newWords.length > queryWords.size * 0.3 && options.query.length > 50) {
1228
- try {
1229
- enrichMemory(topResult.memory.id, options.query, 'search');
1230
- }
1231
- catch {
1232
- // enrichment is best-effort
1233
- }
1234
- }
1235
- }
1236
- }
1237
- const finalResults = sortedResults.slice(0, limit);
1238
- for (const result of finalResults) {
1239
- const contradictions = db.prepare(`
1240
- SELECT ml.strength,
1241
- CASE WHEN ml.source_id = ? THEN ml.target_id ELSE ml.source_id END as other_id
1242
- FROM memory_links ml
1243
- WHERE ml.relationship = 'contradicts'
1244
- AND (ml.source_id = ? OR ml.target_id = ?)
1245
- `).all(result.memory.id, result.memory.id, result.memory.id);
1246
- if (contradictions.length > 0) {
1247
- result.contradictions = contradictions.map((contradiction) => {
1248
- const other = db.prepare('SELECT title FROM memories WHERE id = ?').get(contradiction.other_id);
1249
- return { memoryId: contradiction.other_id, title: other?.title || 'Unknown', score: contradiction.strength };
1250
- });
1251
- if (result.explanation) {
1252
- result.explanation.reasons.push(`${contradictions.length} contradiction link${contradictions.length === 1 ? '' : 's'} attached`);
1253
- }
1254
- }
1255
- }
1256
- if (source) {
1257
- const db2 = getDatabase();
1258
- return finalResults.filter(result => {
1259
- const row = db2.prepare('SELECT source, sensitivity_level FROM memories WHERE id = ?').get(result.memory.id);
1260
- const policy = checkAccess({ id: result.memory.id, source: row?.source, sensitivity_level: row?.sensitivity_level }, source, 'read');
1261
- if (!policy.canRead) {
1262
- logAccessDenial(result.memory.id, source, policy.reason);
1263
- return false;
1264
- }
1265
- return true;
1266
- });
1267
- }
1268
- return finalResults;
1269
- }
1270
- /**
1271
- * Search memories using full-text search, vector similarity, and filters
1272
- * Now uses hybrid search combining FTS5 keywords with semantic vector matching
1273
- */
1274
- let searchCount = 0;
1275
- export async function searchMemories(options, config = DEFAULT_CONFIG, source) {
1276
- return searchMemoriesInternal(options, config, source, {
1277
- enableSideEffects: true,
1278
- includeExplanation: false,
1279
- });
1280
- }
1281
- export async function searchMemoriesExplained(options, config = DEFAULT_CONFIG, source) {
1282
- return searchMemoriesInternal(options, config, source, {
1283
- enableSideEffects: false,
1284
- includeExplanation: true,
1285
- });
1286
- }
1287
- /**
1288
- * Recall with embedding-based vector similarity fallback.
1289
- *
1290
- * 1. First tries FTS5 search (existing searchMemories)
1291
- * 2. If FTS5 returns < 3 results, also runs embedding similarity search
1292
- * 3. Merges results (FTS5 first, then embedding results not already in FTS5 set)
1293
- * 4. Caps at `limit` (default 15)
1294
- * 5. The `threshold` (default 0.3) filters out low-similarity embedding results
1295
- */
1296
- export async function recallWithEmbeddings(query, options) {
1297
- const limit = options?.limit ?? 15;
1298
- const threshold = options?.threshold ?? 0.3;
1299
- // Step 1: Try FTS5 search first
1300
- let ftsResults = options?.existingResults ?? [];
1301
- if (ftsResults.length === 0) {
1302
- try {
1303
- ftsResults = await searchMemories({
1304
- query,
1305
- project: options?.project,
1306
- limit,
1307
- includeGlobal: true,
1308
- });
1309
- }
1310
- catch (e) {
1311
- // FTS search failed — continue to embedding fallback
1312
- console.warn('[shieldcortex] FTS search failed in recallWithEmbeddings:', e.message);
1313
- }
1314
- }
1315
- const ftsMemories = ftsResults.map(r => r.memory);
1316
- // Step 2: If FTS5 returns >= 3 results, no need for embedding fallback
1317
- if (ftsMemories.length >= 3) {
1318
- return ftsMemories.slice(0, limit);
1319
- }
1320
- // Step 3: Run embedding similarity search as fallback
1321
- try {
1322
- const { initEmbeddings } = await import('./embedding.js');
1323
- const ready = await initEmbeddings();
1324
- if (!ready) {
1325
- return ftsMemories.slice(0, limit);
1326
- }
1327
- // Get candidate memories from the database (not already in FTS results)
1328
- const ftsIds = new Set(ftsMemories.map(m => m.id));
1329
- const db = getDatabase();
1330
- let sql = 'SELECT id, title, content FROM memories WHERE 1=1';
1331
- const params = [];
1332
- if (options?.project) {
1333
- sql += ` AND (project = ? OR scope = 'global')`;
1334
- params.push(options.project);
1335
- }
1336
- sql += ' ORDER BY salience DESC, last_accessed DESC LIMIT 200';
1337
- const candidates = db.prepare(sql).all(...params);
1338
- // Filter out memories already returned by FTS
1339
- const newCandidates = candidates.filter(c => !ftsIds.has(c.id));
1340
- if (newCandidates.length === 0) {
1341
- return ftsMemories.slice(0, limit);
1342
- }
1343
- const queryEmbedding = options?.queryEmbedding ?? await getCachedQueryEmbedding(query);
1344
- if (!queryEmbedding) {
1345
- return ftsMemories.slice(0, limit);
1346
- }
1347
- // Find similar memories using embeddings
1348
- const remainingSlots = limit - ftsMemories.length;
1349
- const similar = await findSimilarMemories(query, newCandidates, remainingSlots, queryEmbedding);
1350
- // Filter by threshold and fetch full Memory objects
1351
- const embeddingMemories = [];
1352
- for (const hit of similar) {
1353
- if (hit.score < threshold)
1354
- continue;
1355
- const row = db.prepare('SELECT * FROM memories WHERE id = ?').get(hit.id);
1356
- if (row) {
1357
- embeddingMemories.push(rowToMemory(row));
1358
- }
1359
- }
1360
- // Step 4: Merge — FTS results first, then embedding results
1361
- const merged = [...ftsMemories, ...embeddingMemories];
1362
- return merged.slice(0, limit);
1363
- }
1364
- catch (e) {
1365
- // Embedding fallback failed — return whatever FTS found
1366
- console.warn('[shieldcortex] Embedding fallback failed:', e.message);
1367
- return ftsMemories.slice(0, limit);
1368
- }
1369
- }
1370
779
  /**
1371
780
  * Get all memories for a project
1372
781
  */
@@ -1435,38 +844,6 @@ export function getHighPriorityMemories(limit = 10, project, source) {
1435
844
  rows = filterRowsByAccess(rows, source);
1436
845
  return rows.slice(0, limit).map(rowToMemory);
1437
846
  }
1438
- /**
1439
- * Promote a memory from short-term to long-term
1440
- */
1441
- export function promoteMemory(id) {
1442
- const db = getDatabase();
1443
- db.prepare(`
1444
- UPDATE memories
1445
- SET type = 'long_term'
1446
- WHERE id = ? AND type = 'short_term'
1447
- `).run(id);
1448
- return getMemoryById(id);
1449
- }
1450
- /**
1451
- * Bulk delete decayed memories
1452
- */
1453
- export function cleanupDecayedMemories(config = DEFAULT_CONFIG) {
1454
- const db = getDatabase();
1455
- // Get all short-term memories and check decay
1456
- const shortTerm = getMemoriesByType('short_term', 1000);
1457
- const toDelete = [];
1458
- for (const memory of shortTerm) {
1459
- const decayedScore = calculateDecayedScore(memory, config);
1460
- if (decayedScore < config.salienceThreshold) {
1461
- toDelete.push(memory.id);
1462
- }
1463
- }
1464
- if (toDelete.length > 0) {
1465
- const placeholders = toDelete.map(() => '?').join(',');
1466
- db.prepare(`DELETE FROM memories WHERE id IN (${placeholders})`).run(...toDelete);
1467
- }
1468
- return toDelete.length;
1469
- }
1470
847
  /**
1471
848
  * Get memory statistics
1472
849
  */
@@ -1503,219 +880,33 @@ export function getMemoryStats(project) {
1503
880
  averageSalience,
1504
881
  };
1505
882
  }
1506
- /**
1507
- * Create a link between two memories
1508
- */
1509
- export function createMemoryLink(sourceId, targetId, relationship, strength = 0.5) {
1510
- const db = getDatabase();
1511
- // Verify both memories exist
1512
- const source = getMemoryById(sourceId);
1513
- const target = getMemoryById(targetId);
1514
- if (!source || !target)
1515
- return null;
1516
- // Prevent self-links
1517
- if (sourceId === targetId)
1518
- return null;
1519
- try {
1520
- const result = db.prepare(`
1521
- INSERT INTO memory_links (source_id, target_id, relationship, strength)
1522
- VALUES (?, ?, ?, ?)
1523
- `).run(sourceId, targetId, relationship, strength);
1524
- return {
1525
- id: result.lastInsertRowid,
1526
- sourceId,
1527
- targetId,
1528
- relationship,
1529
- strength,
1530
- createdAt: new Date(),
1531
- };
1532
- }
1533
- catch {
1534
- // Link already exists (UNIQUE constraint)
1535
- return null;
1536
- }
1537
- }
1538
- /**
1539
- * Get all memories related to a given memory
1540
- */
1541
- export function getRelatedMemories(memoryId) {
1542
- const db = getDatabase();
1543
- // Get outgoing links (this memory references others)
1544
- const outgoing = db.prepare(`
1545
- SELECT m.*, ml.relationship, ml.strength
1546
- FROM memory_links ml
1547
- JOIN memories m ON m.id = ml.target_id
1548
- WHERE ml.source_id = ?
1549
- `).all(memoryId);
1550
- // Get incoming links (other memories reference this one)
1551
- const incoming = db.prepare(`
1552
- SELECT m.*, ml.relationship, ml.strength
1553
- FROM memory_links ml
1554
- JOIN memories m ON m.id = ml.source_id
1555
- WHERE ml.target_id = ?
1556
- `).all(memoryId);
1557
- const results = [];
1558
- for (const row of outgoing) {
1559
- results.push({
1560
- memory: rowToMemory(row),
1561
- relationship: row.relationship,
1562
- strength: row.strength,
1563
- direction: 'outgoing',
1564
- });
1565
- }
1566
- for (const row of incoming) {
1567
- results.push({
1568
- memory: rowToMemory(row),
1569
- relationship: row.relationship,
1570
- strength: row.strength,
1571
- direction: 'incoming',
1572
- });
1573
- }
1574
- return results;
1575
- }
1576
- /**
1577
- * Delete a memory link
1578
- */
1579
- export function deleteMemoryLink(sourceId, targetId) {
1580
- const db = getDatabase();
1581
- const result = db.prepare(`
1582
- DELETE FROM memory_links WHERE source_id = ? AND target_id = ?
1583
- `).run(sourceId, targetId);
1584
- return result.changes > 0;
1585
- }
1586
- /**
1587
- * Get all memory links
1588
- */
1589
- export function getAllMemoryLinks() {
1590
- const db = getDatabase();
1591
- const rows = db.prepare(`SELECT * FROM memory_links ORDER BY created_at DESC`).all();
1592
- return rows.map(row => ({
1593
- id: row.id,
1594
- sourceId: row.source_id,
1595
- targetId: row.target_id,
1596
- relationship: row.relationship,
1597
- strength: row.strength,
1598
- createdAt: new Date(row.created_at),
1599
- }));
1600
- }
1601
- /**
1602
- * Detect tag-based links for a memory.
1603
- * Finds memories sharing tags and scores by overlap count.
1604
- */
1605
- function detectTagLinks(db, memory, maxResults) {
1606
- const results = [];
1607
- if (memory.tags.length > 0) {
1608
- const tagPlaceholders = memory.tags.map(() => '?').join(',');
1609
- const tagMatches = db.prepare(`
1610
- SELECT DISTINCT m.id, m.tags
1611
- FROM memories m, json_each(m.tags)
1612
- WHERE json_each.value IN (${tagPlaceholders})
1613
- AND m.id != ?
1614
- LIMIT ?
1615
- `).all(...memory.tags, memory.id, maxResults);
1616
- for (const match of tagMatches) {
1617
- const matchTags = JSON.parse(match.tags);
1618
- const sharedCount = memory.tags.filter(t => matchTags.includes(t)).length;
1619
- const strength = Math.min(0.9, 0.3 + (sharedCount * 0.2));
1620
- results.push({ targetId: match.id, relationship: 'related', strength });
1621
- }
1622
- }
1623
- return results;
1624
- }
1625
- /**
1626
- * Detect embedding-based semantic links for a memory.
1627
- * Computes cosine similarity against top memories that have embeddings.
1628
- */
1629
- function detectEmbeddingLinks(db, memory, maxResults) {
1630
- if (!memory.embedding)
1631
- return [];
1632
- const candidates = db.prepare(`
1633
- SELECT id, embedding FROM memories
1634
- WHERE embedding IS NOT NULL AND id != ?
1635
- ORDER BY decayed_score DESC
1636
- LIMIT 100
1637
- `).all(memory.id);
1638
- const results = [];
1639
- const sourceEmbedding = new Float32Array(memory.embedding.buffer, memory.embedding.byteOffset, memory.embedding.byteLength / 4);
1640
- for (const candidate of candidates) {
1641
- const candidateEmbedding = new Float32Array(candidate.embedding.buffer, candidate.embedding.byteOffset, candidate.embedding.byteLength / 4);
1642
- const similarity = cosineSimilarity(sourceEmbedding, candidateEmbedding);
1643
- if (similarity >= 0.6) {
1644
- results.push({
1645
- targetId: candidate.id,
1646
- relationship: 'related',
1647
- strength: Math.min(0.9, similarity),
1648
- });
1649
- }
1650
- }
1651
- return results;
1652
- }
1653
- /**
1654
- * Detect content-based links using FTS5 and Jaccard similarity.
1655
- * Fallback when embeddings are not available.
1656
- */
1657
- function detectFtsLinks(db, memory, maxResults) {
1658
- const queryText = `${memory.title} ${memory.content.slice(0, 200)}`;
1659
- const escapedQuery = escapeFts5Query(queryText);
1660
- if (!escapedQuery.trim())
1661
- return [];
1662
- let ftsMatches;
1663
- try {
1664
- ftsMatches = db.prepare(`
1665
- SELECT m.id, m.title, m.content
1666
- FROM memories_fts fts
1667
- JOIN memories m ON m.id = fts.rowid
1668
- WHERE memories_fts MATCH ?
1669
- AND m.id != ?
1670
- LIMIT ?
1671
- `).all(escapedQuery, memory.id, maxResults * 2);
1672
- }
1673
- catch {
1674
- return [];
1675
- }
1676
- const results = [];
1677
- for (const match of ftsMatches) {
1678
- const matchText = `${match.title} ${match.content.slice(0, 200)}`;
1679
- const sim = jaccardSimilarity(queryText, matchText);
1680
- if (sim >= 0.3) {
1681
- results.push({
1682
- targetId: match.id,
1683
- relationship: 'related',
1684
- strength: Math.min(0.7, sim + 0.2),
1685
- });
1686
- }
1687
- }
1688
- return results;
1689
- }
1690
- /**
1691
- * Detect potential relationships for a new memory
1692
- * Uses three strategies in priority order:
1693
- * 1. Tag-based linking (shared tags)
1694
- * 2. Embedding-based semantic linking (cosine similarity >= 0.6)
1695
- * 3. FTS content similarity fallback (Jaccard similarity >= 0.3)
1696
- */
1697
- export function detectRelationships(memory, maxResults = 5) {
1698
- const db = getDatabase();
1699
- const seen = new Set();
1700
- const results = [];
1701
- function addResults(links) {
1702
- for (const link of links) {
1703
- if (!seen.has(link.targetId)) {
1704
- seen.add(link.targetId);
1705
- results.push(link);
1706
- }
1707
- }
1708
- }
1709
- // 1. Tag-based linking
1710
- addResults(detectTagLinks(db, memory, maxResults));
1711
- // 2. Embedding-based semantic linking
1712
- addResults(detectEmbeddingLinks(db, memory, maxResults));
1713
- // 3. FTS content similarity fallback (when no embeddings)
1714
- if (!memory.embedding) {
1715
- addResults(detectFtsLinks(db, memory, maxResults));
1716
- }
1717
- // Sort by strength descending and limit
1718
- return results
1719
- .sort((a, b) => b.strength - a.strength)
1720
- .slice(0, maxResults);
1721
- }
883
+ // ============================================================================
884
+ // MEMORY RELATIONSHIPS (LINKS) moved to ./links.ts
885
+ // ============================================================================
886
+ // The link API was extracted into src/memory/links.ts so the store module can
887
+ // be read concern-by-concern instead of as one 2,100-line file. Re-exported
888
+ // here so every existing `import { ... } from '.../store.js'` path keeps
889
+ // working with zero behaviour change.
890
+ export { createMemoryLink, getRelatedMemories, deleteMemoryLink, getAllMemoryLinks, detectRelationships, } from './links.js';
891
+ // ============================================================================
892
+ // MEMORY LIFECYCLE — moved to ./lifecycle.ts
893
+ // ============================================================================
894
+ // Phase 2 of the store.ts split. The lifecycle group (access reinforcement,
895
+ // search reinforcement, enrichment, decay-score persistence, STM→LTM
896
+ // promotion, decayed-memory cleanup) lives in src/memory/lifecycle.ts.
897
+ // Re-exported here so every existing `import { ... } from '.../store.js'`
898
+ // path keeps working with zero behaviour change.
899
+ export { accessMemory, reinforceFromSearch, enrichMemory, clearEnrichmentCooldown, getEnrichmentCooldownStatus, updateDecayScores, promoteMemory, cleanupDecayedMemories, } from './lifecycle.js';
900
+ // ============================================================================
901
+ // MEMORY SEARCH / RECALL — moved to ./search-recall.ts
902
+ // ============================================================================
903
+ // Phase 3 of the store.ts split. The search/recall group (the public
904
+ // `searchMemories`, `searchMemoriesExplained`, `recallWithEmbeddings`
905
+ // entry points plus the internal `searchMemoriesInternal` pipeline and
906
+ // the module-level `searchCount` activation-cache pruner) lives in
907
+ // src/memory/search-recall.ts. Re-exported here so every existing
908
+ // `import { ... } from '.../store.js'` path keeps working with zero
909
+ // behaviour change. search-recall.ts imports `rowToMemory` and
910
+ // `logAccessDenial` back from store.ts via the same function-body-only
911
+ // cycle pattern used by links.ts and lifecycle.ts.
912
+ export { searchMemories, searchMemoriesExplained, recallWithEmbeddings, } from './search-recall.js';