shieldcortex 4.25.5 → 4.27.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 (232) 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/server/app/_global-error.html +2 -2
  4. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
  5. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  8. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  9. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +2 -2
  11. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +1 -1
  12. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  13. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  14. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  15. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  16. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  17. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  18. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.html +1 -1
  19. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.rsc +1 -1
  20. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk/admin/__PAGE__.segment.rsc +1 -1
  21. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk/admin.segment.rsc +1 -1
  22. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  23. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_full.segment.rsc +1 -1
  24. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_head.segment.rsc +1 -1
  25. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_index.segment.rsc +1 -1
  26. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_tree.segment.rsc +1 -1
  27. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.html +1 -1
  28. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.rsc +1 -1
  29. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk/cloud/__PAGE__.segment.rsc +1 -1
  30. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk/cloud.segment.rsc +1 -1
  31. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  32. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_full.segment.rsc +1 -1
  33. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_head.segment.rsc +1 -1
  34. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_index.segment.rsc +1 -1
  35. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_tree.segment.rsc +1 -1
  36. package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
  37. package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +1 -1
  38. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  39. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +1 -1
  40. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
  41. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +1 -1
  42. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  43. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.html +1 -1
  44. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.rsc +1 -1
  45. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory/capture/__PAGE__.segment.rsc +1 -1
  46. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory/capture.segment.rsc +1 -1
  47. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  48. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  49. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_full.segment.rsc +1 -1
  50. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_head.segment.rsc +1 -1
  51. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_index.segment.rsc +1 -1
  52. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_tree.segment.rsc +1 -1
  53. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.html +1 -1
  54. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.rsc +1 -1
  55. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory/graph/__PAGE__.segment.rsc +1 -1
  56. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory/graph.segment.rsc +1 -1
  57. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  58. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  59. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_full.segment.rsc +1 -1
  60. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_head.segment.rsc +1 -1
  61. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_index.segment.rsc +1 -1
  62. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_tree.segment.rsc +1 -1
  63. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.html +1 -1
  64. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.rsc +1 -1
  65. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory/recall/__PAGE__.segment.rsc +1 -1
  66. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory/recall.segment.rsc +1 -1
  67. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  68. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  69. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_full.segment.rsc +1 -1
  70. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_head.segment.rsc +1 -1
  71. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_index.segment.rsc +1 -1
  72. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_tree.segment.rsc +1 -1
  73. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.html +2 -2
  74. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.rsc +1 -1
  75. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.segments/!KGRhc2hib2FyZCk/memory/replay/__PAGE__.segment.rsc +1 -1
  76. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.segments/!KGRhc2hib2FyZCk/memory/replay.segment.rsc +1 -1
  77. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  78. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  79. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.segments/_full.segment.rsc +1 -1
  80. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.segments/_head.segment.rsc +1 -1
  81. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.segments/_index.segment.rsc +1 -1
  82. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/replay.segments/_tree.segment.rsc +1 -1
  83. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.html +1 -1
  84. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.rsc +1 -1
  85. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory/review/__PAGE__.segment.rsc +1 -1
  86. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory/review.segment.rsc +1 -1
  87. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  88. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  89. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_full.segment.rsc +1 -1
  90. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_head.segment.rsc +1 -1
  91. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_index.segment.rsc +1 -1
  92. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_tree.segment.rsc +1 -1
  93. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.html +1 -1
  94. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.rsc +1 -1
  95. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory/timeline/__PAGE__.segment.rsc +1 -1
  96. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory/timeline.segment.rsc +1 -1
  97. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  98. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  99. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_full.segment.rsc +1 -1
  100. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_head.segment.rsc +1 -1
  101. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_index.segment.rsc +1 -1
  102. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_tree.segment.rsc +1 -1
  103. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.html +2 -2
  104. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.rsc +1 -1
  105. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk/memory/__PAGE__.segment.rsc +1 -1
  106. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  107. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  108. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_full.segment.rsc +1 -1
  109. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_head.segment.rsc +1 -1
  110. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_index.segment.rsc +1 -1
  111. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_tree.segment.rsc +1 -1
  112. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.html +2 -2
  113. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.rsc +1 -1
  114. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk/overview/__PAGE__.segment.rsc +1 -1
  115. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk/overview.segment.rsc +1 -1
  116. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  117. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_full.segment.rsc +1 -1
  118. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_head.segment.rsc +1 -1
  119. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_index.segment.rsc +1 -1
  120. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_tree.segment.rsc +1 -1
  121. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.html +1 -1
  122. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.rsc +1 -1
  123. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection/audit/__PAGE__.segment.rsc +1 -1
  124. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection/audit.segment.rsc +1 -1
  125. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  126. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  127. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_full.segment.rsc +1 -1
  128. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_head.segment.rsc +1 -1
  129. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_index.segment.rsc +1 -1
  130. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_tree.segment.rsc +1 -1
  131. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.html +1 -1
  132. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.rsc +1 -1
  133. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection/intercepts/__PAGE__.segment.rsc +1 -1
  134. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection/intercepts.segment.rsc +1 -1
  135. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  136. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  137. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_full.segment.rsc +1 -1
  138. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_head.segment.rsc +1 -1
  139. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_index.segment.rsc +1 -1
  140. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_tree.segment.rsc +1 -1
  141. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.html +1 -1
  142. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.rsc +1 -1
  143. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection/iron-dome/__PAGE__.segment.rsc +1 -1
  144. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection/iron-dome.segment.rsc +1 -1
  145. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  146. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  147. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_full.segment.rsc +1 -1
  148. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_head.segment.rsc +1 -1
  149. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_index.segment.rsc +1 -1
  150. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_tree.segment.rsc +1 -1
  151. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.html +1 -1
  152. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.rsc +1 -1
  153. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection/policies/__PAGE__.segment.rsc +1 -1
  154. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection/policies.segment.rsc +1 -1
  155. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  156. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  157. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_full.segment.rsc +1 -1
  158. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_head.segment.rsc +1 -1
  159. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_index.segment.rsc +1 -1
  160. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_tree.segment.rsc +1 -1
  161. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.html +1 -1
  162. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.rsc +1 -1
  163. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection/quarantine/__PAGE__.segment.rsc +1 -1
  164. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection/quarantine.segment.rsc +1 -1
  165. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  166. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  167. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_full.segment.rsc +1 -1
  168. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_head.segment.rsc +1 -1
  169. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_index.segment.rsc +1 -1
  170. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_tree.segment.rsc +1 -1
  171. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.html +2 -2
  172. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.rsc +1 -1
  173. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk/protection/__PAGE__.segment.rsc +1 -1
  174. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  175. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  176. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_full.segment.rsc +1 -1
  177. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_head.segment.rsc +1 -1
  178. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_index.segment.rsc +1 -1
  179. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_tree.segment.rsc +1 -1
  180. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.html +2 -2
  181. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.rsc +1 -1
  182. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings/__PAGE__.segment.rsc +1 -1
  183. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings.segment.rsc +1 -1
  184. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  185. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_full.segment.rsc +1 -1
  186. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  187. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_index.segment.rsc +1 -1
  188. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  189. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.html +1 -1
  190. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.rsc +1 -1
  191. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain/xray/__PAGE__.segment.rsc +1 -1
  192. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain/xray.segment.rsc +1 -1
  193. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain.segment.rsc +1 -1
  194. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  195. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_full.segment.rsc +1 -1
  196. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_head.segment.rsc +1 -1
  197. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_index.segment.rsc +1 -1
  198. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_tree.segment.rsc +1 -1
  199. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.html +1 -1
  200. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.rsc +1 -1
  201. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk/supply-chain/__PAGE__.segment.rsc +1 -1
  202. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk/supply-chain.segment.rsc +1 -1
  203. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  204. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_full.segment.rsc +1 -1
  205. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_head.segment.rsc +1 -1
  206. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_index.segment.rsc +1 -1
  207. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_tree.segment.rsc +1 -1
  208. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.html +2 -2
  209. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.rsc +1 -1
  210. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk/xray/__PAGE__.segment.rsc +1 -1
  211. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk/xray.segment.rsc +1 -1
  212. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk.segment.rsc +1 -1
  213. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_full.segment.rsc +1 -1
  214. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_head.segment.rsc +1 -1
  215. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_index.segment.rsc +1 -1
  216. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_tree.segment.rsc +1 -1
  217. package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +2 -2
  218. package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
  219. package/dist/cli/doctor.js +1 -1
  220. package/dist/cli/update.js +21 -0
  221. package/dist/database/init.js +2 -755
  222. package/dist/database/inline-schema.d.ts +15 -0
  223. package/dist/database/inline-schema.js +319 -0
  224. package/dist/database/migrations.d.ts +48 -0
  225. package/dist/database/migrations.js +506 -0
  226. package/dist/setup/quickstart.js +54 -0
  227. package/package.json +1 -1
  228. package/scripts/lib/dashboard-hint.mjs +71 -0
  229. package/scripts/postinstall.mjs +13 -0
  230. /package/dashboard/.next/standalone/dashboard/.next/static/{eiXzjGydPq7Vc5bq6Ohjr → CGvPUupL70GmSXZuLa4TO}/_buildManifest.js +0 -0
  231. /package/dashboard/.next/standalone/dashboard/.next/static/{eiXzjGydPq7Vc5bq6Ohjr → CGvPUupL70GmSXZuLa4TO}/_clientMiddlewareManifest.json +0 -0
  232. /package/dashboard/.next/standalone/dashboard/.next/static/{eiXzjGydPq7Vc5bq6Ohjr → CGvPUupL70GmSXZuLa4TO}/_ssgManifest.js +0 -0
@@ -7,8 +7,8 @@ import { basename, dirname, join } from 'path';
7
7
  import { homedir } from 'os';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { execSync } from 'child_process';
10
- import { randomUUID } from 'crypto';
11
- import { seedDefaultFirewallRules } from './seed-firewall-rules.js';
10
+ import { runMigrations } from './migrations.js';
11
+ import { getInlineSchema } from './inline-schema.js';
12
12
  const _currentFile = fileURLToPath(import.meta.url);
13
13
  const _currentDir = dirname(_currentFile);
14
14
  let db = null;
@@ -535,451 +535,6 @@ export function initDatabase(dbPath) {
535
535
  }
536
536
  return db;
537
537
  }
538
- /**
539
- * Run database migrations for existing databases
540
- */
541
- function runMigrations(database) {
542
- // Check if memories table exists (skip migrations on fresh database)
543
- const tableExists = database.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='memories'").get();
544
- if (!tableExists) {
545
- // Fresh database - schema will create everything
546
- return;
547
- }
548
- // Check existing columns
549
- const tableInfo = database.prepare("PRAGMA table_info(memories)").all();
550
- const columnNames = new Set(tableInfo.map(col => col.name));
551
- // Migration: decayed_score column
552
- if (!columnNames.has('decayed_score')) {
553
- database.exec('ALTER TABLE memories ADD COLUMN decayed_score REAL');
554
- database.exec('CREATE INDEX IF NOT EXISTS idx_memories_decayed_score ON memories(decayed_score DESC)');
555
- }
556
- // Migration: embedding column for semantic search
557
- if (!columnNames.has('embedding')) {
558
- database.exec('ALTER TABLE memories ADD COLUMN embedding BLOB');
559
- }
560
- // Migration: scope column for cross-project knowledge
561
- if (!columnNames.has('scope')) {
562
- database.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT 'project'");
563
- }
564
- // Migration: transferable column for cross-project sharing
565
- if (!columnNames.has('transferable')) {
566
- database.exec('ALTER TABLE memories ADD COLUMN transferable INTEGER DEFAULT 0');
567
- }
568
- // Migration: Defence columns on memories table
569
- if (!columnNames.has('trust_score')) {
570
- database.exec("ALTER TABLE memories ADD COLUMN trust_score REAL DEFAULT 1.0");
571
- }
572
- if (!columnNames.has('sensitivity_level')) {
573
- database.exec("ALTER TABLE memories ADD COLUMN sensitivity_level TEXT DEFAULT 'INTERNAL'");
574
- }
575
- if (!columnNames.has('source')) {
576
- database.exec("ALTER TABLE memories ADD COLUMN source TEXT DEFAULT 'user:direct'");
577
- }
578
- if (!columnNames.has('status')) {
579
- database.exec("ALTER TABLE memories ADD COLUMN status TEXT DEFAULT 'active'");
580
- }
581
- if (!columnNames.has('pinned')) {
582
- database.exec('ALTER TABLE memories ADD COLUMN pinned INTEGER DEFAULT 0');
583
- }
584
- if (!columnNames.has('reviewed_at')) {
585
- database.exec('ALTER TABLE memories ADD COLUMN reviewed_at TIMESTAMP');
586
- }
587
- if (!columnNames.has('reviewed_by')) {
588
- database.exec('ALTER TABLE memories ADD COLUMN reviewed_by TEXT');
589
- }
590
- if (!columnNames.has('source_kind')) {
591
- database.exec("ALTER TABLE memories ADD COLUMN source_kind TEXT DEFAULT 'user'");
592
- }
593
- if (!columnNames.has('capture_method')) {
594
- database.exec("ALTER TABLE memories ADD COLUMN capture_method TEXT DEFAULT 'manual'");
595
- }
596
- if (!columnNames.has('cloud_excluded')) {
597
- database.exec('ALTER TABLE memories ADD COLUMN cloud_excluded INTEGER DEFAULT 0');
598
- }
599
- if (!columnNames.has('uuid')) {
600
- database.exec("ALTER TABLE memories ADD COLUMN uuid TEXT");
601
- }
602
- if (!columnNames.has('updated_at')) {
603
- database.exec('ALTER TABLE memories ADD COLUMN updated_at TIMESTAMP');
604
- }
605
- try {
606
- const rowsWithoutUuid = database.prepare('SELECT id FROM memories WHERE uuid IS NULL OR uuid = ?').all('');
607
- const setUuid = database.prepare('UPDATE memories SET uuid = ? WHERE id = ?');
608
- for (const row of rowsWithoutUuid) {
609
- setUuid.run(randomUUID(), row.id);
610
- }
611
- database.exec('UPDATE memories SET updated_at = COALESCE(updated_at, created_at, CURRENT_TIMESTAMP) WHERE updated_at IS NULL');
612
- database.exec("UPDATE memories SET status = COALESCE(status, 'active') WHERE status IS NULL OR status = ''");
613
- database.exec('UPDATE memories SET pinned = COALESCE(pinned, 0) WHERE pinned IS NULL');
614
- database.exec(`
615
- UPDATE memories
616
- SET source = CASE
617
- WHEN source = 'user:direct' AND tags LIKE '%session-end%' THEN 'hook:openclaw-session-end'
618
- WHEN source = 'user:direct' AND tags LIKE '%session-stop%' THEN 'hook:openclaw-session-stop'
619
- WHEN source = 'user:direct' AND tags LIKE '%keyword-trigger%' THEN 'hook:openclaw-keyword'
620
- WHEN source IS NULL AND tags LIKE '%llm-output%' THEN 'agent:openclaw-plugin'
621
- ELSE source
622
- END
623
- WHERE
624
- (source = 'user:direct' OR source IS NULL)
625
- AND (
626
- tags LIKE '%session-end%'
627
- OR tags LIKE '%session-stop%'
628
- OR tags LIKE '%keyword-trigger%'
629
- OR tags LIKE '%llm-output%'
630
- OR tags LIKE '%realtime-plugin%'
631
- OR tags LIKE '%openclaw-hook%'
632
- )
633
- `);
634
- database.exec("UPDATE memories SET source_kind = CASE WHEN source LIKE 'hook:%' THEN 'hook' WHEN source LIKE 'api:%' THEN 'api' WHEN source LIKE 'agent:%' THEN 'agent' WHEN source LIKE 'cli:%' THEN 'cli' ELSE COALESCE(source_kind, 'user') END WHERE source_kind IS NULL OR source_kind = ''");
635
- database.exec("UPDATE memories SET capture_method = CASE WHEN tags LIKE '%auto-extracted%' THEN 'auto' WHEN source_kind = 'hook' THEN 'hook' WHEN source_kind = 'api' THEN 'api' WHEN source_kind = 'agent' THEN 'plugin' WHEN source_kind = 'cli' THEN 'manual' ELSE COALESCE(capture_method, 'manual') END WHERE capture_method IS NULL OR capture_method = ''");
636
- database.exec(`
637
- UPDATE memories
638
- SET source_kind = CASE
639
- WHEN tags LIKE '%session-end%' OR tags LIKE '%session-stop%' OR tags LIKE '%keyword-trigger%' OR tags LIKE '%openclaw-hook%' THEN 'hook'
640
- WHEN tags LIKE '%llm-output%' OR tags LIKE '%realtime-plugin%' THEN 'agent'
641
- ELSE source_kind
642
- END,
643
- capture_method = CASE
644
- WHEN tags LIKE '%session-end%' OR tags LIKE '%session-stop%' OR tags LIKE '%openclaw-hook%' THEN 'auto'
645
- WHEN tags LIKE '%keyword-trigger%' THEN 'hook'
646
- WHEN tags LIKE '%llm-output%' OR tags LIKE '%realtime-plugin%' THEN 'auto'
647
- ELSE capture_method
648
- END
649
- WHERE
650
- tags LIKE '%session-end%'
651
- OR tags LIKE '%session-stop%'
652
- OR tags LIKE '%keyword-trigger%'
653
- OR tags LIKE '%openclaw-hook%'
654
- OR tags LIKE '%llm-output%'
655
- OR tags LIKE '%realtime-plugin%'
656
- `);
657
- database.exec('UPDATE memories SET cloud_excluded = COALESCE(cloud_excluded, 0) WHERE cloud_excluded IS NULL');
658
- database.exec('CREATE UNIQUE INDEX IF NOT EXISTS idx_memories_uuid ON memories(uuid)');
659
- database.exec('CREATE INDEX IF NOT EXISTS idx_memories_updated ON memories(updated_at DESC)');
660
- database.exec('CREATE INDEX IF NOT EXISTS idx_memories_status ON memories(status)');
661
- database.exec('CREATE INDEX IF NOT EXISTS idx_memories_pinned ON memories(pinned DESC)');
662
- database.exec('CREATE INDEX IF NOT EXISTS idx_memories_source_kind ON memories(source_kind)');
663
- }
664
- catch {
665
- // Safe to ignore on partially migrated databases
666
- }
667
- // Migration: Defence tables (defence_audit, quarantine, fragmentation_entities)
668
- try {
669
- database.exec(`
670
- CREATE TABLE IF NOT EXISTS defence_audit (
671
- id INTEGER PRIMARY KEY AUTOINCREMENT,
672
- memory_id INTEGER,
673
- project TEXT,
674
- timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
675
- source_type TEXT NOT NULL,
676
- source_identifier TEXT NOT NULL,
677
- trust_score REAL NOT NULL,
678
- sensitivity_level TEXT NOT NULL DEFAULT 'INTERNAL',
679
- firewall_result TEXT NOT NULL CHECK(firewall_result IN ('ALLOW', 'BLOCK', 'QUARANTINE')),
680
- anomaly_score REAL DEFAULT 0.0,
681
- threat_indicators TEXT DEFAULT '[]',
682
- blocked_patterns TEXT DEFAULT '[]',
683
- reason TEXT,
684
- fragmentation_score REAL,
685
- pipeline_duration_ms INTEGER,
686
- FOREIGN KEY (memory_id) REFERENCES memories(id) ON DELETE SET NULL
687
- );
688
- CREATE INDEX IF NOT EXISTS idx_audit_memory ON defence_audit(memory_id);
689
- CREATE INDEX IF NOT EXISTS idx_audit_timestamp ON defence_audit(timestamp DESC);
690
- CREATE INDEX IF NOT EXISTS idx_audit_result ON defence_audit(firewall_result);
691
- CREATE INDEX IF NOT EXISTS idx_audit_source ON defence_audit(source_type);
692
- CREATE INDEX IF NOT EXISTS idx_audit_project ON defence_audit(project);
693
-
694
- CREATE TABLE IF NOT EXISTS quarantine (
695
- id INTEGER PRIMARY KEY AUTOINCREMENT,
696
- original_content TEXT NOT NULL,
697
- original_title TEXT,
698
- project TEXT,
699
- source_type TEXT NOT NULL,
700
- source_identifier TEXT NOT NULL,
701
- reason TEXT NOT NULL,
702
- threat_indicators TEXT DEFAULT '[]',
703
- anomaly_score REAL DEFAULT 0.0,
704
- firewall_result TEXT NOT NULL CHECK(firewall_result IN ('BLOCK', 'QUARANTINE')),
705
- status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending', 'approved', 'rejected', 'expired')),
706
- reviewed_at TIMESTAMP,
707
- reviewed_by TEXT,
708
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
709
- expires_at TIMESTAMP,
710
- audit_id INTEGER,
711
- FOREIGN KEY (audit_id) REFERENCES defence_audit(id) ON DELETE SET NULL
712
- );
713
- CREATE INDEX IF NOT EXISTS idx_quarantine_status ON quarantine(status);
714
- CREATE INDEX IF NOT EXISTS idx_quarantine_created ON quarantine(created_at DESC);
715
-
716
- CREATE TABLE IF NOT EXISTS quarantine_annotations (
717
- id INTEGER PRIMARY KEY AUTOINCREMENT,
718
- item_id INTEGER NOT NULL,
719
- category TEXT NOT NULL,
720
- suggested_action TEXT NOT NULL,
721
- confidence REAL NOT NULL,
722
- similar_group_key TEXT,
723
- copilot_version TEXT NOT NULL,
724
- annotation_json TEXT NOT NULL,
725
- generated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
726
- FOREIGN KEY (item_id) REFERENCES quarantine(id) ON DELETE CASCADE,
727
- UNIQUE(item_id, copilot_version)
728
- );
729
- CREATE INDEX IF NOT EXISTS idx_quarantine_annotations_item ON quarantine_annotations(item_id);
730
- CREATE INDEX IF NOT EXISTS idx_quarantine_annotations_category ON quarantine_annotations(category);
731
- CREATE INDEX IF NOT EXISTS idx_quarantine_annotations_action ON quarantine_annotations(suggested_action);
732
- CREATE INDEX IF NOT EXISTS idx_quarantine_annotations_group ON quarantine_annotations(similar_group_key);
733
-
734
- CREATE TABLE IF NOT EXISTS fragmentation_entities (
735
- id INTEGER PRIMARY KEY AUTOINCREMENT,
736
- memory_id INTEGER NOT NULL,
737
- entity_value TEXT NOT NULL,
738
- entity_type TEXT NOT NULL,
739
- context_snippet TEXT,
740
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
741
- FOREIGN KEY (memory_id) REFERENCES memories(id) ON DELETE CASCADE
742
- );
743
- CREATE INDEX IF NOT EXISTS idx_frag_entities_memory ON fragmentation_entities(memory_id);
744
- CREATE INDEX IF NOT EXISTS idx_frag_entities_text ON fragmentation_entities(entity_value);
745
- CREATE INDEX IF NOT EXISTS idx_frag_entities_type ON fragmentation_entities(entity_type);
746
-
747
- CREATE TABLE IF NOT EXISTS hook_invocations (
748
- id INTEGER PRIMARY KEY AUTOINCREMENT,
749
- hook_name TEXT NOT NULL,
750
- invoked_at TEXT NOT NULL DEFAULT (datetime('now')),
751
- exit_code INTEGER,
752
- duration_ms INTEGER,
753
- memories_extracted INTEGER DEFAULT 0,
754
- transcript_bytes INTEGER,
755
- notes TEXT
756
- );
757
- CREATE INDEX IF NOT EXISTS idx_hook_invocations_name_time ON hook_invocations(hook_name, invoked_at DESC);
758
- `);
759
- }
760
- catch {
761
- // Tables may already exist - safe to ignore
762
- }
763
- // Migration: project column on defence_audit and quarantine tables
764
- try {
765
- const auditCols = database.prepare("PRAGMA table_info(defence_audit)").all();
766
- if (auditCols.length > 0 && !auditCols.some(c => c.name === 'project')) {
767
- database.exec('ALTER TABLE defence_audit ADD COLUMN project TEXT');
768
- database.exec('CREATE INDEX IF NOT EXISTS idx_audit_project ON defence_audit(project)');
769
- }
770
- const quarantineCols = database.prepare("PRAGMA table_info(quarantine)").all();
771
- if (quarantineCols.length > 0 && !quarantineCols.some(c => c.name === 'project')) {
772
- database.exec('ALTER TABLE quarantine ADD COLUMN project TEXT');
773
- }
774
- }
775
- catch {
776
- // Safe to ignore if tables don't exist yet
777
- }
778
- // Backfill: set project on defence_audit/quarantine entries that have NULL project
779
- try {
780
- const nullCount = database.prepare("SELECT COUNT(*) as cnt FROM defence_audit WHERE project IS NULL").get()?.cnt ?? 0;
781
- if (nullCount > 0) {
782
- // From linked memories
783
- database.exec(`UPDATE defence_audit SET project = (
784
- SELECT m.project FROM memories m WHERE m.id = defence_audit.memory_id
785
- ) WHERE memory_id IS NOT NULL AND project IS NULL`);
786
- // Remaining: use most common project
787
- database.exec(`UPDATE defence_audit SET project = (
788
- SELECT project FROM memories WHERE project IS NOT NULL GROUP BY project ORDER BY COUNT(*) DESC LIMIT 1
789
- ) WHERE project IS NULL`);
790
- }
791
- const qNullCount = database.prepare("SELECT COUNT(*) as cnt FROM quarantine WHERE project IS NULL").get()?.cnt ?? 0;
792
- if (qNullCount > 0) {
793
- database.exec(`UPDATE quarantine SET project = (
794
- SELECT project FROM memories WHERE project IS NOT NULL GROUP BY project ORDER BY COUNT(*) DESC LIMIT 1
795
- ) WHERE project IS NULL`);
796
- }
797
- }
798
- catch {
799
- // Safe to ignore
800
- }
801
- // Migration: sync_queue table for cloud sync retry
802
- try {
803
- database.exec(`
804
- CREATE TABLE IF NOT EXISTS sync_queue (
805
- id INTEGER PRIMARY KEY AUTOINCREMENT,
806
- payload TEXT NOT NULL,
807
- attempts INTEGER DEFAULT 0,
808
- max_attempts INTEGER DEFAULT 3,
809
- next_retry_at TEXT NOT NULL,
810
- status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending','failed','synced')),
811
- last_error TEXT,
812
- created_at TEXT DEFAULT (datetime('now')),
813
- synced_at TEXT
814
- );
815
- CREATE INDEX IF NOT EXISTS idx_sync_queue_status_retry ON sync_queue(status, next_retry_at);
816
- `);
817
- }
818
- catch {
819
- // Table may already exist - safe to ignore
820
- }
821
- // Migration: Ontology tables (entities, triples, memory_entities)
822
- try {
823
- database.exec(`
824
- CREATE TABLE IF NOT EXISTS entities (
825
- id INTEGER PRIMARY KEY AUTOINCREMENT,
826
- name TEXT NOT NULL,
827
- type TEXT NOT NULL,
828
- aliases TEXT DEFAULT '[]',
829
- first_seen TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
830
- memory_count INTEGER DEFAULT 0,
831
- UNIQUE(name, type)
832
- );
833
- CREATE INDEX IF NOT EXISTS idx_entities_name ON entities(name);
834
- CREATE INDEX IF NOT EXISTS idx_entities_type ON entities(type);
835
-
836
- CREATE TABLE IF NOT EXISTS triples (
837
- id INTEGER PRIMARY KEY AUTOINCREMENT,
838
- subject_id INTEGER NOT NULL,
839
- predicate TEXT NOT NULL,
840
- object_id INTEGER NOT NULL,
841
- source_memory_id INTEGER,
842
- confidence REAL DEFAULT 0.8,
843
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
844
- FOREIGN KEY (subject_id) REFERENCES entities(id) ON DELETE CASCADE,
845
- FOREIGN KEY (object_id) REFERENCES entities(id) ON DELETE CASCADE,
846
- FOREIGN KEY (source_memory_id) REFERENCES memories(id) ON DELETE SET NULL,
847
- UNIQUE(subject_id, predicate, object_id)
848
- );
849
- CREATE INDEX IF NOT EXISTS idx_triples_subject ON triples(subject_id);
850
- CREATE INDEX IF NOT EXISTS idx_triples_object ON triples(object_id);
851
- CREATE INDEX IF NOT EXISTS idx_triples_predicate ON triples(predicate);
852
-
853
- CREATE TABLE IF NOT EXISTS memory_entities (
854
- memory_id INTEGER NOT NULL,
855
- entity_id INTEGER NOT NULL,
856
- role TEXT DEFAULT 'mention',
857
- FOREIGN KEY (memory_id) REFERENCES memories(id) ON DELETE CASCADE,
858
- FOREIGN KEY (entity_id) REFERENCES entities(id) ON DELETE CASCADE,
859
- PRIMARY KEY (memory_id, entity_id)
860
- );
861
- `);
862
- }
863
- catch {
864
- // Tables may already exist - safe to ignore
865
- }
866
- // Migration: graph_extraction_version column for incremental graph backfill
867
- if (!columnNames.has('graph_extraction_version')) {
868
- database.exec('ALTER TABLE memories ADD COLUMN graph_extraction_version INTEGER DEFAULT 0');
869
- }
870
- // Migration: v4.0.0 — memory_purpose for type taxonomy
871
- if (!columnNames.has('memory_purpose')) {
872
- database.exec("ALTER TABLE memories ADD COLUMN memory_purpose TEXT DEFAULT 'project'");
873
- }
874
- // Migration: v4.0.0 — memory_scope for private/team visibility
875
- if (!columnNames.has('memory_scope')) {
876
- database.exec("ALTER TABLE memories ADD COLUMN memory_scope TEXT DEFAULT 'private'");
877
- }
878
- // Migration: v4.25.0 — downvote_count for negative-feedback salience.
879
- // When a user marks a memory unhelpful via `shieldcortex memory downvote
880
- // <id>`, the count grows and the recall hook's effective-salience
881
- // calculation multiplies in a (1 - 0.3 × n) penalty (floored at 0.1).
882
- if (!columnNames.has('downvote_count')) {
883
- database.exec('ALTER TABLE memories ADD COLUMN downvote_count INTEGER DEFAULT 0');
884
- }
885
- if (!columnNames.has('last_downvoted_at')) {
886
- database.exec('ALTER TABLE memories ADD COLUMN last_downvoted_at TIMESTAMP');
887
- }
888
- // Sparse partial index — only indexes rows that have been downvoted.
889
- // Cheap to maintain (most rows never downvoted) and lets the CLI list
890
- // downvoted memories without a full scan.
891
- database.exec('CREATE INDEX IF NOT EXISTS idx_memories_downvote_count ON memories(downvote_count) WHERE downvote_count > 0');
892
- // Migration: Pro feature tables (custom_patterns, iron_dome_policies, firewall_rules)
893
- try {
894
- database.exec(`
895
- CREATE TABLE IF NOT EXISTS custom_patterns (
896
- id INTEGER PRIMARY KEY AUTOINCREMENT,
897
- name TEXT NOT NULL,
898
- category TEXT NOT NULL DEFAULT 'custom',
899
- severity TEXT NOT NULL DEFAULT 'medium' CHECK(severity IN ('critical', 'high', 'medium', 'low')),
900
- regex TEXT NOT NULL,
901
- description TEXT DEFAULT '',
902
- enabled INTEGER NOT NULL DEFAULT 1,
903
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
904
- );
905
- CREATE INDEX IF NOT EXISTS idx_custom_patterns_enabled ON custom_patterns(enabled);
906
-
907
- CREATE TABLE IF NOT EXISTS iron_dome_policies (
908
- id INTEGER PRIMARY KEY AUTOINCREMENT,
909
- name TEXT NOT NULL,
910
- description TEXT DEFAULT '',
911
- config TEXT NOT NULL DEFAULT '{}',
912
- is_active INTEGER NOT NULL DEFAULT 0,
913
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
914
- );
915
- CREATE UNIQUE INDEX IF NOT EXISTS idx_dome_policies_active ON iron_dome_policies(is_active) WHERE is_active = 1;
916
-
917
- CREATE TABLE IF NOT EXISTS firewall_rules (
918
- id INTEGER PRIMARY KEY AUTOINCREMENT,
919
- name TEXT NOT NULL,
920
- priority INTEGER NOT NULL DEFAULT 100,
921
- condition_type TEXT NOT NULL,
922
- condition_value TEXT NOT NULL,
923
- action TEXT NOT NULL CHECK(action IN ('block', 'allow', 'quarantine')),
924
- enabled INTEGER NOT NULL DEFAULT 1,
925
- built_in INTEGER NOT NULL DEFAULT 0,
926
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
927
- );
928
- CREATE INDEX IF NOT EXISTS idx_firewall_rules_priority ON firewall_rules(priority);
929
- CREATE INDEX IF NOT EXISTS idx_firewall_rules_enabled ON firewall_rules(enabled);
930
- CREATE INDEX IF NOT EXISTS idx_firewall_rules_built_in ON firewall_rules(built_in);
931
-
932
- CREATE TABLE IF NOT EXISTS rate_limits (
933
- source_key TEXT PRIMARY KEY,
934
- write_count INTEGER NOT NULL DEFAULT 1,
935
- window_start_ms INTEGER NOT NULL
936
- );
937
- `);
938
- }
939
- catch {
940
- // Tables may already exist - safe to ignore
941
- }
942
- // Migration: built_in column on pre-existing firewall_rules (added in v4.15)
943
- try {
944
- const cols = database.prepare("PRAGMA table_info(firewall_rules)").all();
945
- if (!cols.some(c => c.name === 'built_in')) {
946
- database.exec('ALTER TABLE firewall_rules ADD COLUMN built_in INTEGER NOT NULL DEFAULT 0');
947
- database.exec('CREATE INDEX IF NOT EXISTS idx_firewall_rules_built_in ON firewall_rules(built_in)');
948
- }
949
- }
950
- catch {
951
- // Best-effort migration; pipeline handles missing column gracefully.
952
- }
953
- // Seed default built-in firewall rules on first init.
954
- try {
955
- seedDefaultFirewallRules(database);
956
- }
957
- catch {
958
- // Seeder runs idempotently; failures here should never block startup.
959
- }
960
- // Migration: session_events.content_hash + dedupe UNIQUE index (v4.17).
961
- // DBs created between the foundation commit and the importer commit have
962
- // session_events but no content_hash column. ALTER + idempotent index
963
- // upgrades them without touching fresh installs (schema.sql handles those).
964
- try {
965
- const sessionEventsTable = database
966
- .prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='session_events'")
967
- .get();
968
- if (sessionEventsTable) {
969
- const sessionCols = database
970
- .prepare("PRAGMA table_info(session_events)")
971
- .all();
972
- const sessionColNames = new Set(sessionCols.map((c) => c.name));
973
- if (!sessionColNames.has('content_hash')) {
974
- database.exec('ALTER TABLE session_events ADD COLUMN content_hash TEXT');
975
- }
976
- database.exec('CREATE UNIQUE INDEX IF NOT EXISTS idx_session_events_dedupe ON session_events(session_id, ts, kind, content_hash)');
977
- }
978
- }
979
- catch {
980
- // Best-effort; importer-side INSERT OR IGNORE handles missing index gracefully.
981
- }
982
- }
983
538
  /**
984
539
  * Get the current database instance
985
540
  */
@@ -1197,314 +752,6 @@ export function checkDatabaseSize() {
1197
752
  export function isDatabaseBlocked() {
1198
753
  return checkDatabaseSize().blocked;
1199
754
  }
1200
- /**
1201
- * Inline schema for bundled deployment
1202
- */
1203
- function getInlineSchema() {
1204
- return `
1205
- CREATE TABLE IF NOT EXISTS memories (
1206
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1207
- uuid TEXT NOT NULL UNIQUE,
1208
- type TEXT NOT NULL CHECK(type IN ('short_term', 'long_term', 'episodic')),
1209
- category TEXT NOT NULL DEFAULT 'note',
1210
- title TEXT NOT NULL,
1211
- content TEXT NOT NULL,
1212
- project TEXT,
1213
- tags TEXT DEFAULT '[]',
1214
- salience REAL DEFAULT 0.5 CHECK(salience >= 0 AND salience <= 1),
1215
- decayed_score REAL,
1216
- access_count INTEGER DEFAULT 0,
1217
- last_accessed TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1218
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1219
- updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1220
- metadata TEXT DEFAULT '{}',
1221
- embedding BLOB,
1222
- scope TEXT DEFAULT 'project',
1223
- transferable INTEGER DEFAULT 0,
1224
- trust_score REAL DEFAULT 1.0,
1225
- sensitivity_level TEXT DEFAULT 'INTERNAL',
1226
- source TEXT DEFAULT 'user:direct',
1227
- status TEXT DEFAULT 'active' CHECK(status IN ('active', 'archived', 'suppressed', 'canonical')),
1228
- pinned INTEGER DEFAULT 0,
1229
- reviewed_at TIMESTAMP,
1230
- reviewed_by TEXT,
1231
- source_kind TEXT DEFAULT 'user',
1232
- capture_method TEXT DEFAULT 'manual',
1233
- cloud_excluded INTEGER DEFAULT 0,
1234
- graph_extraction_version INTEGER DEFAULT 0,
1235
- memory_purpose TEXT DEFAULT 'project',
1236
- memory_scope TEXT DEFAULT 'private',
1237
- downvote_count INTEGER DEFAULT 0,
1238
- last_downvoted_at TIMESTAMP
1239
- );
1240
-
1241
- CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(
1242
- title,
1243
- content,
1244
- tags,
1245
- content='memories',
1246
- content_rowid='id',
1247
- tokenize='porter unicode61'
1248
- );
1249
-
1250
- CREATE TRIGGER IF NOT EXISTS memories_ai AFTER INSERT ON memories BEGIN
1251
- INSERT INTO memories_fts(rowid, title, content, tags)
1252
- VALUES (new.id, new.title, new.content, new.tags);
1253
- END;
1254
-
1255
- CREATE TRIGGER IF NOT EXISTS memories_ad AFTER DELETE ON memories BEGIN
1256
- INSERT INTO memories_fts(memories_fts, rowid, title, content, tags)
1257
- VALUES('delete', old.id, old.title, old.content, old.tags);
1258
- END;
1259
-
1260
- CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE ON memories BEGIN
1261
- INSERT INTO memories_fts(memories_fts, rowid, title, content, tags)
1262
- VALUES('delete', old.id, old.title, old.content, old.tags);
1263
- INSERT INTO memories_fts(rowid, title, content, tags)
1264
- VALUES (new.id, new.title, new.content, new.tags);
1265
- END;
1266
-
1267
- CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(type);
1268
- CREATE UNIQUE INDEX IF NOT EXISTS idx_memories_uuid ON memories(uuid);
1269
- CREATE INDEX IF NOT EXISTS idx_memories_project ON memories(project);
1270
- CREATE INDEX IF NOT EXISTS idx_memories_category ON memories(category);
1271
- CREATE INDEX IF NOT EXISTS idx_memories_salience ON memories(salience DESC);
1272
- CREATE INDEX IF NOT EXISTS idx_memories_decayed_score ON memories(decayed_score DESC);
1273
- CREATE INDEX IF NOT EXISTS idx_memories_last_accessed ON memories(last_accessed DESC);
1274
- CREATE INDEX IF NOT EXISTS idx_memories_updated ON memories(updated_at DESC);
1275
-
1276
- CREATE TABLE IF NOT EXISTS sessions (
1277
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1278
- project TEXT,
1279
- started_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1280
- ended_at TIMESTAMP,
1281
- summary TEXT,
1282
- memories_created INTEGER DEFAULT 0,
1283
- memories_accessed INTEGER DEFAULT 0
1284
- );
1285
-
1286
- CREATE TABLE IF NOT EXISTS memory_links (
1287
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1288
- source_id INTEGER NOT NULL,
1289
- target_id INTEGER NOT NULL,
1290
- relationship TEXT NOT NULL,
1291
- strength REAL DEFAULT 0.5,
1292
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1293
- FOREIGN KEY (source_id) REFERENCES memories(id) ON DELETE CASCADE,
1294
- FOREIGN KEY (target_id) REFERENCES memories(id) ON DELETE CASCADE,
1295
- UNIQUE(source_id, target_id)
1296
- );
1297
-
1298
- -- Events table for cross-process IPC (MCP → Dashboard)
1299
- CREATE TABLE IF NOT EXISTS events (
1300
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1301
- type TEXT NOT NULL,
1302
- data TEXT,
1303
- timestamp TEXT NOT NULL,
1304
- processed INTEGER DEFAULT 0
1305
- );
1306
-
1307
- CREATE INDEX IF NOT EXISTS idx_events_processed ON events(processed, id);
1308
-
1309
- CREATE TABLE IF NOT EXISTS entities (
1310
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1311
- name TEXT NOT NULL,
1312
- type TEXT NOT NULL,
1313
- aliases TEXT DEFAULT '[]',
1314
- first_seen TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1315
- memory_count INTEGER DEFAULT 0,
1316
- UNIQUE(name, type)
1317
- );
1318
-
1319
- CREATE INDEX IF NOT EXISTS idx_entities_name ON entities(name);
1320
- CREATE INDEX IF NOT EXISTS idx_entities_type ON entities(type);
1321
-
1322
- CREATE TABLE IF NOT EXISTS triples (
1323
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1324
- subject_id INTEGER NOT NULL,
1325
- predicate TEXT NOT NULL,
1326
- object_id INTEGER NOT NULL,
1327
- source_memory_id INTEGER,
1328
- confidence REAL DEFAULT 0.8,
1329
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1330
- FOREIGN KEY (subject_id) REFERENCES entities(id) ON DELETE CASCADE,
1331
- FOREIGN KEY (object_id) REFERENCES entities(id) ON DELETE CASCADE,
1332
- FOREIGN KEY (source_memory_id) REFERENCES memories(id) ON DELETE SET NULL,
1333
- UNIQUE(subject_id, predicate, object_id)
1334
- );
1335
-
1336
- CREATE INDEX IF NOT EXISTS idx_triples_subject ON triples(subject_id);
1337
- CREATE INDEX IF NOT EXISTS idx_triples_object ON triples(object_id);
1338
- CREATE INDEX IF NOT EXISTS idx_triples_predicate ON triples(predicate);
1339
-
1340
- CREATE TABLE IF NOT EXISTS memory_entities (
1341
- memory_id INTEGER NOT NULL,
1342
- entity_id INTEGER NOT NULL,
1343
- role TEXT DEFAULT 'mention',
1344
- FOREIGN KEY (memory_id) REFERENCES memories(id) ON DELETE CASCADE,
1345
- FOREIGN KEY (entity_id) REFERENCES entities(id) ON DELETE CASCADE,
1346
- PRIMARY KEY (memory_id, entity_id)
1347
- );
1348
-
1349
- CREATE TABLE IF NOT EXISTS defence_audit (
1350
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1351
- memory_id INTEGER,
1352
- project TEXT,
1353
- timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1354
- source_type TEXT NOT NULL,
1355
- source_identifier TEXT NOT NULL,
1356
- trust_score REAL NOT NULL,
1357
- sensitivity_level TEXT NOT NULL DEFAULT 'INTERNAL',
1358
- firewall_result TEXT NOT NULL CHECK(firewall_result IN ('ALLOW', 'BLOCK', 'QUARANTINE')),
1359
- anomaly_score REAL DEFAULT 0.0,
1360
- threat_indicators TEXT DEFAULT '[]',
1361
- blocked_patterns TEXT DEFAULT '[]',
1362
- reason TEXT,
1363
- fragmentation_score REAL,
1364
- pipeline_duration_ms INTEGER,
1365
- FOREIGN KEY (memory_id) REFERENCES memories(id) ON DELETE SET NULL
1366
- );
1367
-
1368
- CREATE INDEX IF NOT EXISTS idx_audit_memory ON defence_audit(memory_id);
1369
- CREATE INDEX IF NOT EXISTS idx_audit_timestamp ON defence_audit(timestamp DESC);
1370
- CREATE INDEX IF NOT EXISTS idx_audit_result ON defence_audit(firewall_result);
1371
- CREATE INDEX IF NOT EXISTS idx_audit_source ON defence_audit(source_type);
1372
- CREATE INDEX IF NOT EXISTS idx_audit_project ON defence_audit(project);
1373
-
1374
- CREATE TABLE IF NOT EXISTS quarantine (
1375
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1376
- original_content TEXT NOT NULL,
1377
- original_title TEXT,
1378
- project TEXT,
1379
- source_type TEXT NOT NULL,
1380
- source_identifier TEXT NOT NULL,
1381
- reason TEXT NOT NULL,
1382
- threat_indicators TEXT DEFAULT '[]',
1383
- anomaly_score REAL DEFAULT 0.0,
1384
- firewall_result TEXT NOT NULL CHECK(firewall_result IN ('BLOCK', 'QUARANTINE')),
1385
- status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending', 'approved', 'rejected', 'expired')),
1386
- reviewed_at TIMESTAMP,
1387
- reviewed_by TEXT,
1388
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1389
- expires_at TIMESTAMP,
1390
- audit_id INTEGER,
1391
- FOREIGN KEY (audit_id) REFERENCES defence_audit(id) ON DELETE SET NULL
1392
- );
1393
-
1394
- CREATE INDEX IF NOT EXISTS idx_quarantine_status ON quarantine(status);
1395
- CREATE INDEX IF NOT EXISTS idx_quarantine_created ON quarantine(created_at DESC);
1396
-
1397
- CREATE TABLE IF NOT EXISTS quarantine_annotations (
1398
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1399
- item_id INTEGER NOT NULL,
1400
- category TEXT NOT NULL,
1401
- suggested_action TEXT NOT NULL,
1402
- confidence REAL NOT NULL,
1403
- similar_group_key TEXT,
1404
- copilot_version TEXT NOT NULL,
1405
- annotation_json TEXT NOT NULL,
1406
- generated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1407
- FOREIGN KEY (item_id) REFERENCES quarantine(id) ON DELETE CASCADE,
1408
- UNIQUE(item_id, copilot_version)
1409
- );
1410
-
1411
- CREATE INDEX IF NOT EXISTS idx_quarantine_annotations_item ON quarantine_annotations(item_id);
1412
- CREATE INDEX IF NOT EXISTS idx_quarantine_annotations_category ON quarantine_annotations(category);
1413
- CREATE INDEX IF NOT EXISTS idx_quarantine_annotations_action ON quarantine_annotations(suggested_action);
1414
- CREATE INDEX IF NOT EXISTS idx_quarantine_annotations_group ON quarantine_annotations(similar_group_key);
1415
-
1416
- CREATE TABLE IF NOT EXISTS fragmentation_entities (
1417
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1418
- memory_id INTEGER NOT NULL,
1419
- entity_value TEXT NOT NULL,
1420
- entity_type TEXT NOT NULL,
1421
- context_snippet TEXT,
1422
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1423
- FOREIGN KEY (memory_id) REFERENCES memories(id) ON DELETE CASCADE
1424
- );
1425
-
1426
- CREATE INDEX IF NOT EXISTS idx_frag_entities_memory ON fragmentation_entities(memory_id);
1427
- CREATE INDEX IF NOT EXISTS idx_frag_entities_text ON fragmentation_entities(entity_value);
1428
- CREATE INDEX IF NOT EXISTS idx_frag_entities_type ON fragmentation_entities(entity_type);
1429
-
1430
- CREATE TABLE IF NOT EXISTS sync_queue (
1431
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1432
- payload TEXT NOT NULL,
1433
- attempts INTEGER DEFAULT 0,
1434
- max_attempts INTEGER DEFAULT 3,
1435
- next_retry_at TEXT NOT NULL,
1436
- status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending','failed','synced')),
1437
- last_error TEXT,
1438
- created_at TEXT DEFAULT (datetime('now')),
1439
- synced_at TEXT
1440
- );
1441
-
1442
- CREATE INDEX IF NOT EXISTS idx_sync_queue_status_retry ON sync_queue(status, next_retry_at);
1443
-
1444
- CREATE TABLE IF NOT EXISTS custom_patterns (
1445
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1446
- name TEXT NOT NULL,
1447
- category TEXT NOT NULL DEFAULT 'custom',
1448
- severity TEXT NOT NULL DEFAULT 'medium' CHECK(severity IN ('critical', 'high', 'medium', 'low')),
1449
- regex TEXT NOT NULL,
1450
- description TEXT DEFAULT '',
1451
- enabled INTEGER NOT NULL DEFAULT 1,
1452
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
1453
- );
1454
- CREATE INDEX IF NOT EXISTS idx_custom_patterns_enabled ON custom_patterns(enabled);
1455
-
1456
- CREATE TABLE IF NOT EXISTS iron_dome_policies (
1457
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1458
- name TEXT NOT NULL,
1459
- description TEXT DEFAULT '',
1460
- config TEXT NOT NULL DEFAULT '{}',
1461
- is_active INTEGER NOT NULL DEFAULT 0,
1462
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
1463
- );
1464
- CREATE UNIQUE INDEX IF NOT EXISTS idx_dome_policies_active ON iron_dome_policies(is_active) WHERE is_active = 1;
1465
-
1466
- CREATE TABLE IF NOT EXISTS firewall_rules (
1467
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1468
- name TEXT NOT NULL,
1469
- priority INTEGER NOT NULL DEFAULT 100,
1470
- condition_type TEXT NOT NULL,
1471
- condition_value TEXT NOT NULL,
1472
- action TEXT NOT NULL CHECK(action IN ('block', 'allow', 'quarantine')),
1473
- enabled INTEGER NOT NULL DEFAULT 1,
1474
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
1475
- );
1476
- CREATE INDEX IF NOT EXISTS idx_firewall_rules_priority ON firewall_rules(priority);
1477
- CREATE INDEX IF NOT EXISTS idx_firewall_rules_enabled ON firewall_rules(enabled);
1478
-
1479
- CREATE TABLE IF NOT EXISTS rate_limits (
1480
- source_key TEXT PRIMARY KEY,
1481
- write_count INTEGER NOT NULL DEFAULT 1,
1482
- window_start_ms INTEGER NOT NULL
1483
- );
1484
-
1485
- -- v4.17 Session capture (mirrors schema.sql; bundled fallback only).
1486
- CREATE TABLE IF NOT EXISTS session_events (
1487
- id INTEGER PRIMARY KEY AUTOINCREMENT,
1488
- session_id TEXT NOT NULL,
1489
- project TEXT,
1490
- ts TIMESTAMP NOT NULL,
1491
- kind TEXT NOT NULL CHECK(kind IN (
1492
- 'prompt', 'response', 'tool_call', 'tool_result', 'tool_error', 'hook_fire'
1493
- )),
1494
- actor TEXT,
1495
- payload TEXT NOT NULL,
1496
- duration_ms INTEGER,
1497
- audit_id INTEGER,
1498
- content_hash TEXT,
1499
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1500
- FOREIGN KEY (audit_id) REFERENCES defence_audit(id) ON DELETE SET NULL
1501
- );
1502
- CREATE INDEX IF NOT EXISTS idx_session_events_session ON session_events(session_id, ts);
1503
- CREATE INDEX IF NOT EXISTS idx_session_events_project ON session_events(project, ts DESC);
1504
- CREATE UNIQUE INDEX IF NOT EXISTS idx_session_events_dedupe
1505
- ON session_events(session_id, ts, kind, content_hash);
1506
- `;
1507
- }
1508
755
  /**
1509
756
  * Execute a function within a transaction (auto-commits on success, rollback on error)
1510
757
  * Use this for batch operations that need atomicity