@pan-sec/notebooklm-mcp 2026.3.3 → 2026.4.1

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 (470) hide show
  1. package/dist/auth/auth-manager.d.ts +0 -1
  2. package/dist/auth/auth-manager.js +0 -1
  3. package/dist/auth/mcp-auth.d.ts +0 -1
  4. package/dist/auth/mcp-auth.js +0 -1
  5. package/dist/compliance/alert-manager.d.ts +6 -2
  6. package/dist/compliance/alert-manager.js +40 -10
  7. package/dist/compliance/breach-detection.d.ts +0 -1
  8. package/dist/compliance/breach-detection.js +0 -1
  9. package/dist/compliance/change-log.d.ts +13 -1
  10. package/dist/compliance/change-log.js +82 -16
  11. package/dist/compliance/compliance-logger.d.ts +29 -3
  12. package/dist/compliance/compliance-logger.js +90 -27
  13. package/dist/compliance/compliance-tools.d.ts +0 -1
  14. package/dist/compliance/compliance-tools.js +0 -1
  15. package/dist/compliance/consent-manager.d.ts +0 -1
  16. package/dist/compliance/consent-manager.js +0 -1
  17. package/dist/compliance/dashboard.d.ts +4 -3
  18. package/dist/compliance/dashboard.js +11 -8
  19. package/dist/compliance/data-classification.d.ts +0 -1
  20. package/dist/compliance/data-classification.js +0 -1
  21. package/dist/compliance/data-erasure.d.ts +0 -1
  22. package/dist/compliance/data-erasure.js +0 -1
  23. package/dist/compliance/data-export.d.ts +0 -1
  24. package/dist/compliance/data-export.js +0 -1
  25. package/dist/compliance/data-inventory.d.ts +0 -1
  26. package/dist/compliance/data-inventory.js +0 -1
  27. package/dist/compliance/dsar-handler.d.ts +0 -1
  28. package/dist/compliance/dsar-handler.js +0 -1
  29. package/dist/compliance/evidence-collector.d.ts +0 -1
  30. package/dist/compliance/evidence-collector.js +4 -2
  31. package/dist/compliance/health-monitor.d.ts +0 -1
  32. package/dist/compliance/health-monitor.js +0 -1
  33. package/dist/compliance/incident-manager.d.ts +0 -1
  34. package/dist/compliance/incident-manager.js +0 -1
  35. package/dist/compliance/index.d.ts +0 -1
  36. package/dist/compliance/index.js +0 -1
  37. package/dist/compliance/policy-docs.d.ts +0 -1
  38. package/dist/compliance/policy-docs.js +0 -1
  39. package/dist/compliance/privacy-notice-text.d.ts +0 -1
  40. package/dist/compliance/privacy-notice-text.js +0 -1
  41. package/dist/compliance/privacy-notice.d.ts +0 -1
  42. package/dist/compliance/privacy-notice.js +0 -1
  43. package/dist/compliance/report-generator.d.ts +7 -1
  44. package/dist/compliance/report-generator.js +116 -34
  45. package/dist/compliance/retention-engine.d.ts +0 -1
  46. package/dist/compliance/retention-engine.js +0 -1
  47. package/dist/compliance/siem-exporter.d.ts +26 -2
  48. package/dist/compliance/siem-exporter.js +89 -24
  49. package/dist/compliance/types.d.ts +0 -1
  50. package/dist/compliance/types.js +0 -1
  51. package/dist/config.d.ts +0 -1
  52. package/dist/config.js +2 -3
  53. package/dist/errors.d.ts +0 -1
  54. package/dist/errors.js +0 -1
  55. package/dist/events/event-emitter.d.ts +9 -1
  56. package/dist/events/event-emitter.js +47 -8
  57. package/dist/events/event-types.d.ts +0 -1
  58. package/dist/events/event-types.js +8 -2
  59. package/dist/gemini/gemini-client.d.ts +0 -1
  60. package/dist/gemini/gemini-client.js +237 -45
  61. package/dist/gemini/index.d.ts +0 -1
  62. package/dist/gemini/index.js +0 -1
  63. package/dist/gemini/pdf-chunker.d.ts +0 -1
  64. package/dist/gemini/pdf-chunker.js +60 -35
  65. package/dist/gemini/types.d.ts +0 -1
  66. package/dist/gemini/types.js +0 -1
  67. package/dist/index.d.ts +0 -1
  68. package/dist/index.js +60 -7
  69. package/dist/library/notebook-library.d.ts +30 -2
  70. package/dist/library/notebook-library.js +345 -85
  71. package/dist/library/types.d.ts +0 -1
  72. package/dist/library/types.js +0 -1
  73. package/dist/logging/index.d.ts +0 -1
  74. package/dist/logging/index.js +0 -1
  75. package/dist/logging/query-logger.d.ts +20 -1
  76. package/dist/logging/query-logger.js +104 -21
  77. package/dist/notebook-creation/audio-manager.d.ts +7 -16
  78. package/dist/notebook-creation/audio-manager.js +115 -58
  79. package/dist/notebook-creation/browser-options.d.ts +0 -1
  80. package/dist/notebook-creation/browser-options.js +0 -1
  81. package/dist/notebook-creation/data-table-manager.d.ts +8 -14
  82. package/dist/notebook-creation/data-table-manager.js +64 -37
  83. package/dist/notebook-creation/dom-scripts.d.ts +0 -1
  84. package/dist/notebook-creation/dom-scripts.js +0 -1
  85. package/dist/notebook-creation/errors.d.ts +0 -1
  86. package/dist/notebook-creation/errors.js +0 -1
  87. package/dist/notebook-creation/index.d.ts +0 -1
  88. package/dist/notebook-creation/index.js +0 -1
  89. package/dist/notebook-creation/notebook-creator.d.ts +9 -1
  90. package/dist/notebook-creation/notebook-creator.js +50 -1
  91. package/dist/notebook-creation/notebook-nav.d.ts +0 -1
  92. package/dist/notebook-creation/notebook-nav.js +21 -6
  93. package/dist/notebook-creation/notebook-sync.d.ts +14 -2
  94. package/dist/notebook-creation/notebook-sync.js +124 -35
  95. package/dist/notebook-creation/selectors.d.ts +0 -1
  96. package/dist/notebook-creation/selectors.js +6 -4
  97. package/dist/notebook-creation/source-manager-shared.d.ts +75 -0
  98. package/dist/notebook-creation/source-manager-shared.js +86 -0
  99. package/dist/notebook-creation/source-manager.d.ts +29 -2
  100. package/dist/notebook-creation/source-manager.js +0 -0
  101. package/dist/notebook-creation/studio-manager-base.d.ts +57 -0
  102. package/dist/notebook-creation/studio-manager-base.js +67 -0
  103. package/dist/notebook-creation/types.d.ts +0 -1
  104. package/dist/notebook-creation/types.js +0 -1
  105. package/dist/notebook-creation/video-manager.d.ts +3 -16
  106. package/dist/notebook-creation/video-manager.js +94 -53
  107. package/dist/observability/metrics.d.ts +0 -1
  108. package/dist/observability/metrics.js +0 -1
  109. package/dist/quota/index.d.ts +0 -1
  110. package/dist/quota/index.js +0 -1
  111. package/dist/quota/quota-manager.d.ts +59 -4
  112. package/dist/quota/quota-manager.js +195 -46
  113. package/dist/resources/resource-handlers.d.ts +0 -1
  114. package/dist/resources/resource-handlers.js +33 -3
  115. package/dist/session/browser-session.d.ts +0 -1
  116. package/dist/session/browser-session.js +0 -1
  117. package/dist/session/session-manager.d.ts +0 -1
  118. package/dist/session/session-manager.js +0 -1
  119. package/dist/session/session-timeout.d.ts +0 -1
  120. package/dist/session/session-timeout.js +0 -1
  121. package/dist/session/shared-context-manager.d.ts +0 -1
  122. package/dist/session/shared-context-manager.js +0 -1
  123. package/dist/tools/annotations.d.ts +0 -1
  124. package/dist/tools/annotations.js +0 -1
  125. package/dist/tools/definitions/ask-question.d.ts +6 -3
  126. package/dist/tools/definitions/ask-question.js +12 -8
  127. package/dist/tools/definitions/chat-history.d.ts +0 -1
  128. package/dist/tools/definitions/chat-history.js +1 -1
  129. package/dist/tools/definitions/data-tables.d.ts +0 -1
  130. package/dist/tools/definitions/data-tables.js +4 -1
  131. package/dist/tools/definitions/gemini.d.ts +0 -1
  132. package/dist/tools/definitions/gemini.js +14 -7
  133. package/dist/tools/definitions/notebook-management.d.ts +0 -1
  134. package/dist/tools/definitions/notebook-management.js +7 -2
  135. package/dist/tools/definitions/query-history.d.ts +0 -1
  136. package/dist/tools/definitions/query-history.js +0 -1
  137. package/dist/tools/definitions/session-management.d.ts +0 -1
  138. package/dist/tools/definitions/session-management.js +0 -1
  139. package/dist/tools/definitions/system.d.ts +0 -1
  140. package/dist/tools/definitions/system.js +32 -12
  141. package/dist/tools/definitions/video.d.ts +0 -1
  142. package/dist/tools/definitions/video.js +6 -3
  143. package/dist/tools/definitions.d.ts +0 -1
  144. package/dist/tools/definitions.js +0 -1
  145. package/dist/tools/handlers/ask-question.d.ts +0 -1
  146. package/dist/tools/handlers/ask-question.js +47 -18
  147. package/dist/tools/handlers/audio-video.d.ts +0 -1
  148. package/dist/tools/handlers/audio-video.js +0 -1
  149. package/dist/tools/handlers/auth.d.ts +0 -1
  150. package/dist/tools/handlers/auth.js +0 -1
  151. package/dist/tools/handlers/error-utils.d.ts +0 -1
  152. package/dist/tools/handlers/error-utils.js +0 -1
  153. package/dist/tools/handlers/gemini.d.ts +0 -1
  154. package/dist/tools/handlers/gemini.js +0 -1
  155. package/dist/tools/handlers/index.d.ts +0 -1
  156. package/dist/tools/handlers/index.js +0 -1
  157. package/dist/tools/handlers/notebook-creation.d.ts +0 -1
  158. package/dist/tools/handlers/notebook-creation.js +16 -1
  159. package/dist/tools/handlers/notebook-management.d.ts +0 -1
  160. package/dist/tools/handlers/notebook-management.js +7 -2
  161. package/dist/tools/handlers/session-management.d.ts +0 -1
  162. package/dist/tools/handlers/session-management.js +0 -1
  163. package/dist/tools/handlers/system.d.ts +0 -1
  164. package/dist/tools/handlers/system.js +0 -1
  165. package/dist/tools/handlers/types.d.ts +0 -1
  166. package/dist/tools/handlers/types.js +0 -1
  167. package/dist/tools/handlers/webhooks.d.ts +0 -1
  168. package/dist/tools/handlers/webhooks.js +0 -1
  169. package/dist/tools/icons.d.ts +0 -1
  170. package/dist/tools/icons.js +0 -1
  171. package/dist/tools/index.d.ts +0 -1
  172. package/dist/tools/index.js +0 -1
  173. package/dist/types.d.ts +0 -1
  174. package/dist/types.js +0 -1
  175. package/dist/utils/audit-logger.d.ts +11 -1
  176. package/dist/utils/audit-logger.js +189 -21
  177. package/dist/utils/cleanup-manager.d.ts +0 -1
  178. package/dist/utils/cleanup-manager.js +0 -1
  179. package/dist/utils/cli-handler.d.ts +0 -1
  180. package/dist/utils/cli-handler.js +0 -1
  181. package/dist/utils/crypto.d.ts +18 -9
  182. package/dist/utils/crypto.js +93 -28
  183. package/dist/utils/file-lock.d.ts +15 -1
  184. package/dist/utils/file-lock.js +67 -59
  185. package/dist/utils/file-permissions.d.ts +0 -1
  186. package/dist/utils/file-permissions.js +35 -7
  187. package/dist/utils/logger.d.ts +0 -1
  188. package/dist/utils/logger.js +0 -1
  189. package/dist/utils/page-utils.d.ts +0 -1
  190. package/dist/utils/page-utils.js +32 -28
  191. package/dist/utils/response-validator.d.ts +0 -1
  192. package/dist/utils/response-validator.js +18 -15
  193. package/dist/utils/secrets-scanner.d.ts +0 -1
  194. package/dist/utils/secrets-scanner.js +32 -7
  195. package/dist/utils/secure-memory.d.ts +34 -16
  196. package/dist/utils/secure-memory.js +40 -25
  197. package/dist/utils/security.d.ts +0 -1
  198. package/dist/utils/security.js +66 -39
  199. package/dist/utils/settings-manager.d.ts +9 -1
  200. package/dist/utils/settings-manager.js +45 -2
  201. package/dist/utils/stealth-utils.d.ts +0 -1
  202. package/dist/utils/stealth-utils.js +11 -9
  203. package/dist/webhooks/index.d.ts +0 -1
  204. package/dist/webhooks/index.js +0 -1
  205. package/dist/webhooks/types.d.ts +0 -1
  206. package/dist/webhooks/types.js +0 -1
  207. package/dist/webhooks/webhook-dispatcher.d.ts +0 -1
  208. package/dist/webhooks/webhook-dispatcher.js +0 -1
  209. package/package.json +5 -4
  210. package/dist/auth/auth-manager.d.ts.map +0 -1
  211. package/dist/auth/auth-manager.js.map +0 -1
  212. package/dist/auth/mcp-auth.d.ts.map +0 -1
  213. package/dist/auth/mcp-auth.js.map +0 -1
  214. package/dist/compliance/alert-manager.d.ts.map +0 -1
  215. package/dist/compliance/alert-manager.js.map +0 -1
  216. package/dist/compliance/breach-detection.d.ts.map +0 -1
  217. package/dist/compliance/breach-detection.js.map +0 -1
  218. package/dist/compliance/change-log.d.ts.map +0 -1
  219. package/dist/compliance/change-log.js.map +0 -1
  220. package/dist/compliance/compliance-logger.d.ts.map +0 -1
  221. package/dist/compliance/compliance-logger.js.map +0 -1
  222. package/dist/compliance/compliance-tools.d.ts.map +0 -1
  223. package/dist/compliance/compliance-tools.js.map +0 -1
  224. package/dist/compliance/consent-manager.d.ts.map +0 -1
  225. package/dist/compliance/consent-manager.js.map +0 -1
  226. package/dist/compliance/dashboard.d.ts.map +0 -1
  227. package/dist/compliance/dashboard.js.map +0 -1
  228. package/dist/compliance/data-classification.d.ts.map +0 -1
  229. package/dist/compliance/data-classification.js.map +0 -1
  230. package/dist/compliance/data-erasure.d.ts.map +0 -1
  231. package/dist/compliance/data-erasure.js.map +0 -1
  232. package/dist/compliance/data-export.d.ts.map +0 -1
  233. package/dist/compliance/data-export.js.map +0 -1
  234. package/dist/compliance/data-inventory.d.ts.map +0 -1
  235. package/dist/compliance/data-inventory.js.map +0 -1
  236. package/dist/compliance/dsar-handler.d.ts.map +0 -1
  237. package/dist/compliance/dsar-handler.js.map +0 -1
  238. package/dist/compliance/evidence-collector.d.ts.map +0 -1
  239. package/dist/compliance/evidence-collector.js.map +0 -1
  240. package/dist/compliance/health-monitor.d.ts.map +0 -1
  241. package/dist/compliance/health-monitor.js.map +0 -1
  242. package/dist/compliance/incident-manager.d.ts.map +0 -1
  243. package/dist/compliance/incident-manager.js.map +0 -1
  244. package/dist/compliance/index.d.ts.map +0 -1
  245. package/dist/compliance/index.js.map +0 -1
  246. package/dist/compliance/policy-docs.d.ts.map +0 -1
  247. package/dist/compliance/policy-docs.js.map +0 -1
  248. package/dist/compliance/privacy-notice-text.d.ts.map +0 -1
  249. package/dist/compliance/privacy-notice-text.js.map +0 -1
  250. package/dist/compliance/privacy-notice.d.ts.map +0 -1
  251. package/dist/compliance/privacy-notice.js.map +0 -1
  252. package/dist/compliance/report-generator.d.ts.map +0 -1
  253. package/dist/compliance/report-generator.js.map +0 -1
  254. package/dist/compliance/retention-engine.d.ts.map +0 -1
  255. package/dist/compliance/retention-engine.js.map +0 -1
  256. package/dist/compliance/siem-exporter.d.ts.map +0 -1
  257. package/dist/compliance/siem-exporter.js.map +0 -1
  258. package/dist/compliance/types.d.ts.map +0 -1
  259. package/dist/compliance/types.js.map +0 -1
  260. package/dist/config.d.ts.map +0 -1
  261. package/dist/config.js.map +0 -1
  262. package/dist/errors.d.ts.map +0 -1
  263. package/dist/errors.js.map +0 -1
  264. package/dist/events/event-emitter.d.ts.map +0 -1
  265. package/dist/events/event-emitter.js.map +0 -1
  266. package/dist/events/event-types.d.ts.map +0 -1
  267. package/dist/events/event-types.js.map +0 -1
  268. package/dist/gemini/gemini-client.d.ts.map +0 -1
  269. package/dist/gemini/gemini-client.js.map +0 -1
  270. package/dist/gemini/index.d.ts.map +0 -1
  271. package/dist/gemini/index.js.map +0 -1
  272. package/dist/gemini/pdf-chunker.d.ts.map +0 -1
  273. package/dist/gemini/pdf-chunker.js.map +0 -1
  274. package/dist/gemini/types.d.ts.map +0 -1
  275. package/dist/gemini/types.js.map +0 -1
  276. package/dist/index.d.ts.map +0 -1
  277. package/dist/index.js.map +0 -1
  278. package/dist/library/notebook-library.d.ts.map +0 -1
  279. package/dist/library/notebook-library.js.map +0 -1
  280. package/dist/library/types.d.ts.map +0 -1
  281. package/dist/library/types.js.map +0 -1
  282. package/dist/logging/index.d.ts.map +0 -1
  283. package/dist/logging/index.js.map +0 -1
  284. package/dist/logging/query-logger.d.ts.map +0 -1
  285. package/dist/logging/query-logger.js.map +0 -1
  286. package/dist/notebook-creation/audio-manager.d.ts.map +0 -1
  287. package/dist/notebook-creation/audio-manager.js.map +0 -1
  288. package/dist/notebook-creation/browser-options.d.ts.map +0 -1
  289. package/dist/notebook-creation/browser-options.js.map +0 -1
  290. package/dist/notebook-creation/data-table-manager.d.ts.map +0 -1
  291. package/dist/notebook-creation/data-table-manager.js.map +0 -1
  292. package/dist/notebook-creation/discover-creation-flow.d.ts +0 -2
  293. package/dist/notebook-creation/discover-creation-flow.d.ts.map +0 -1
  294. package/dist/notebook-creation/discover-creation-flow.js +0 -177
  295. package/dist/notebook-creation/discover-creation-flow.js.map +0 -1
  296. package/dist/notebook-creation/discover-quota.d.ts +0 -2
  297. package/dist/notebook-creation/discover-quota.d.ts.map +0 -1
  298. package/dist/notebook-creation/discover-quota.js +0 -194
  299. package/dist/notebook-creation/discover-quota.js.map +0 -1
  300. package/dist/notebook-creation/discover-source-dialog.d.ts +0 -8
  301. package/dist/notebook-creation/discover-source-dialog.d.ts.map +0 -1
  302. package/dist/notebook-creation/discover-source-dialog.js +0 -134
  303. package/dist/notebook-creation/discover-source-dialog.js.map +0 -1
  304. package/dist/notebook-creation/discover-sources.d.ts +0 -8
  305. package/dist/notebook-creation/discover-sources.d.ts.map +0 -1
  306. package/dist/notebook-creation/discover-sources.js +0 -272
  307. package/dist/notebook-creation/discover-sources.js.map +0 -1
  308. package/dist/notebook-creation/discover-text-input.d.ts +0 -7
  309. package/dist/notebook-creation/discover-text-input.d.ts.map +0 -1
  310. package/dist/notebook-creation/discover-text-input.js +0 -135
  311. package/dist/notebook-creation/discover-text-input.js.map +0 -1
  312. package/dist/notebook-creation/dom-scripts.d.ts.map +0 -1
  313. package/dist/notebook-creation/dom-scripts.js.map +0 -1
  314. package/dist/notebook-creation/errors.d.ts.map +0 -1
  315. package/dist/notebook-creation/errors.js.map +0 -1
  316. package/dist/notebook-creation/index.d.ts.map +0 -1
  317. package/dist/notebook-creation/index.js.map +0 -1
  318. package/dist/notebook-creation/notebook-creator.d.ts.map +0 -1
  319. package/dist/notebook-creation/notebook-creator.js.map +0 -1
  320. package/dist/notebook-creation/notebook-nav.d.ts.map +0 -1
  321. package/dist/notebook-creation/notebook-nav.js.map +0 -1
  322. package/dist/notebook-creation/notebook-sync.d.ts.map +0 -1
  323. package/dist/notebook-creation/notebook-sync.js.map +0 -1
  324. package/dist/notebook-creation/run-discovery.d.ts +0 -11
  325. package/dist/notebook-creation/run-discovery.d.ts.map +0 -1
  326. package/dist/notebook-creation/run-discovery.js +0 -151
  327. package/dist/notebook-creation/run-discovery.js.map +0 -1
  328. package/dist/notebook-creation/selector-discovery.d.ts +0 -65
  329. package/dist/notebook-creation/selector-discovery.d.ts.map +0 -1
  330. package/dist/notebook-creation/selector-discovery.js +0 -414
  331. package/dist/notebook-creation/selector-discovery.js.map +0 -1
  332. package/dist/notebook-creation/selectors.d.ts.map +0 -1
  333. package/dist/notebook-creation/selectors.js.map +0 -1
  334. package/dist/notebook-creation/selectors.ts +0 -112
  335. package/dist/notebook-creation/source-manager.d.ts.map +0 -1
  336. package/dist/notebook-creation/source-manager.js.map +0 -1
  337. package/dist/notebook-creation/test-create.d.ts +0 -8
  338. package/dist/notebook-creation/test-create.d.ts.map +0 -1
  339. package/dist/notebook-creation/test-create.js +0 -72
  340. package/dist/notebook-creation/test-create.js.map +0 -1
  341. package/dist/notebook-creation/types.d.ts.map +0 -1
  342. package/dist/notebook-creation/types.js.map +0 -1
  343. package/dist/notebook-creation/video-manager.d.ts.map +0 -1
  344. package/dist/notebook-creation/video-manager.js.map +0 -1
  345. package/dist/observability/metrics.d.ts.map +0 -1
  346. package/dist/observability/metrics.js.map +0 -1
  347. package/dist/quota/index.d.ts.map +0 -1
  348. package/dist/quota/index.js.map +0 -1
  349. package/dist/quota/quota-manager.d.ts.map +0 -1
  350. package/dist/quota/quota-manager.js.map +0 -1
  351. package/dist/resources/resource-handlers.d.ts.map +0 -1
  352. package/dist/resources/resource-handlers.js.map +0 -1
  353. package/dist/session/browser-session.d.ts.map +0 -1
  354. package/dist/session/browser-session.js.map +0 -1
  355. package/dist/session/session-manager.d.ts.map +0 -1
  356. package/dist/session/session-manager.js.map +0 -1
  357. package/dist/session/session-timeout.d.ts.map +0 -1
  358. package/dist/session/session-timeout.js.map +0 -1
  359. package/dist/session/shared-context-manager.d.ts.map +0 -1
  360. package/dist/session/shared-context-manager.js.map +0 -1
  361. package/dist/tools/annotations.d.ts.map +0 -1
  362. package/dist/tools/annotations.js.map +0 -1
  363. package/dist/tools/definitions/ask-question.d.ts.map +0 -1
  364. package/dist/tools/definitions/ask-question.js.map +0 -1
  365. package/dist/tools/definitions/chat-history.d.ts.map +0 -1
  366. package/dist/tools/definitions/chat-history.js.map +0 -1
  367. package/dist/tools/definitions/data-tables.d.ts.map +0 -1
  368. package/dist/tools/definitions/data-tables.js.map +0 -1
  369. package/dist/tools/definitions/gemini.d.ts.map +0 -1
  370. package/dist/tools/definitions/gemini.js.map +0 -1
  371. package/dist/tools/definitions/notebook-management.d.ts.map +0 -1
  372. package/dist/tools/definitions/notebook-management.js.map +0 -1
  373. package/dist/tools/definitions/query-history.d.ts.map +0 -1
  374. package/dist/tools/definitions/query-history.js.map +0 -1
  375. package/dist/tools/definitions/session-management.d.ts.map +0 -1
  376. package/dist/tools/definitions/session-management.js.map +0 -1
  377. package/dist/tools/definitions/system.d.ts.map +0 -1
  378. package/dist/tools/definitions/system.js.map +0 -1
  379. package/dist/tools/definitions/video.d.ts.map +0 -1
  380. package/dist/tools/definitions/video.js.map +0 -1
  381. package/dist/tools/definitions.d.ts.map +0 -1
  382. package/dist/tools/definitions.js.map +0 -1
  383. package/dist/tools/handlers/ask-question.d.ts.map +0 -1
  384. package/dist/tools/handlers/ask-question.js.map +0 -1
  385. package/dist/tools/handlers/audio-video.d.ts.map +0 -1
  386. package/dist/tools/handlers/audio-video.js.map +0 -1
  387. package/dist/tools/handlers/auth.d.ts.map +0 -1
  388. package/dist/tools/handlers/auth.js.map +0 -1
  389. package/dist/tools/handlers/error-utils.d.ts.map +0 -1
  390. package/dist/tools/handlers/error-utils.js.map +0 -1
  391. package/dist/tools/handlers/gemini.d.ts.map +0 -1
  392. package/dist/tools/handlers/gemini.js.map +0 -1
  393. package/dist/tools/handlers/index.d.ts.map +0 -1
  394. package/dist/tools/handlers/index.js.map +0 -1
  395. package/dist/tools/handlers/notebook-creation.d.ts.map +0 -1
  396. package/dist/tools/handlers/notebook-creation.js.map +0 -1
  397. package/dist/tools/handlers/notebook-management.d.ts.map +0 -1
  398. package/dist/tools/handlers/notebook-management.js.map +0 -1
  399. package/dist/tools/handlers/session-management.d.ts.map +0 -1
  400. package/dist/tools/handlers/session-management.js.map +0 -1
  401. package/dist/tools/handlers/system.d.ts.map +0 -1
  402. package/dist/tools/handlers/system.js.map +0 -1
  403. package/dist/tools/handlers/types.d.ts.map +0 -1
  404. package/dist/tools/handlers/types.js.map +0 -1
  405. package/dist/tools/handlers/webhooks.d.ts.map +0 -1
  406. package/dist/tools/handlers/webhooks.js.map +0 -1
  407. package/dist/tools/handlers.d.ts +0 -666
  408. package/dist/tools/handlers.d.ts.map +0 -1
  409. package/dist/tools/handlers.js +0 -2929
  410. package/dist/tools/handlers.js.map +0 -1
  411. package/dist/tools/icons.d.ts.map +0 -1
  412. package/dist/tools/icons.js.map +0 -1
  413. package/dist/tools/index.d.ts.map +0 -1
  414. package/dist/tools/index.js.map +0 -1
  415. package/dist/types.d.ts.map +0 -1
  416. package/dist/types.js.map +0 -1
  417. package/dist/utils/audit-logger.d.ts.map +0 -1
  418. package/dist/utils/audit-logger.js.map +0 -1
  419. package/dist/utils/cert-pinning.d.ts +0 -97
  420. package/dist/utils/cert-pinning.d.ts.map +0 -1
  421. package/dist/utils/cert-pinning.js +0 -328
  422. package/dist/utils/cert-pinning.js.map +0 -1
  423. package/dist/utils/cleanup-manager.d.ts.map +0 -1
  424. package/dist/utils/cleanup-manager.js.map +0 -1
  425. package/dist/utils/cli-handler.d.ts.map +0 -1
  426. package/dist/utils/cli-handler.js.map +0 -1
  427. package/dist/utils/crypto.d.ts.map +0 -1
  428. package/dist/utils/crypto.js.map +0 -1
  429. package/dist/utils/file-lock.d.ts.map +0 -1
  430. package/dist/utils/file-lock.js.map +0 -1
  431. package/dist/utils/file-permissions.d.ts.map +0 -1
  432. package/dist/utils/file-permissions.js.map +0 -1
  433. package/dist/utils/logger.d.ts.map +0 -1
  434. package/dist/utils/logger.js.map +0 -1
  435. package/dist/utils/page-utils.d.ts.map +0 -1
  436. package/dist/utils/page-utils.js.map +0 -1
  437. package/dist/utils/response-validator.d.ts.map +0 -1
  438. package/dist/utils/response-validator.js.map +0 -1
  439. package/dist/utils/secrets-scanner.d.ts.map +0 -1
  440. package/dist/utils/secrets-scanner.js.map +0 -1
  441. package/dist/utils/secure-memory.d.ts.map +0 -1
  442. package/dist/utils/secure-memory.js.map +0 -1
  443. package/dist/utils/security.d.ts.map +0 -1
  444. package/dist/utils/security.js.map +0 -1
  445. package/dist/utils/settings-manager.d.ts.map +0 -1
  446. package/dist/utils/settings-manager.js.map +0 -1
  447. package/dist/utils/stealth-utils.d.ts.map +0 -1
  448. package/dist/utils/stealth-utils.js.map +0 -1
  449. package/dist/utils/tool-validation.d.ts +0 -93
  450. package/dist/utils/tool-validation.d.ts.map +0 -1
  451. package/dist/utils/tool-validation.js +0 -277
  452. package/dist/utils/tool-validation.js.map +0 -1
  453. package/dist/webhooks/index.d.ts.map +0 -1
  454. package/dist/webhooks/index.js.map +0 -1
  455. package/dist/webhooks/types.d.ts.map +0 -1
  456. package/dist/webhooks/types.js.map +0 -1
  457. package/dist/webhooks/webhook-dispatcher.d.ts.map +0 -1
  458. package/dist/webhooks/webhook-dispatcher.js.map +0 -1
  459. package/docs/COMPLIANCE-SPEC.md +0 -1452
  460. package/docs/MCP-DIRECTORY-LISTINGS.md +0 -91
  461. package/docs/SECURITY-FORK-OPPORTUNITIES.md +0 -79
  462. package/docs/SECURITY_IMPLEMENTATION_PLAN.md +0 -437
  463. package/docs/archive/ISSUES-legacy-2026-04-24.md +0 -644
  464. package/docs/configuration.md +0 -94
  465. package/docs/dependency-risk.md +0 -25
  466. package/docs/improvement-sprint-2026.2.10.md +0 -210
  467. package/docs/testing-runbook.md +0 -166
  468. package/docs/tools.md +0 -34
  469. package/docs/troubleshooting.md +0 -59
  470. package/docs/usage-guide.md +0 -246
@@ -174,4 +174,3 @@ export declare class AuthManager {
174
174
  */
175
175
  hardResetState(): Promise<boolean>;
176
176
  }
177
- //# sourceMappingURL=auth-manager.d.ts.map
@@ -1211,4 +1211,3 @@ export class AuthManager {
1211
1211
  }
1212
1212
  }
1213
1213
  }
1214
- //# sourceMappingURL=auth-manager.js.map
@@ -136,4 +136,3 @@ export declare function authenticateMCPRequest(token: string | undefined, client
136
136
  * (none) — Print help
137
137
  */
138
138
  export declare function handleTokenCommand(args: string[]): Promise<void>;
139
- //# sourceMappingURL=mcp-auth.d.ts.map
@@ -549,4 +549,3 @@ If you lose it, use 'token rotate' to create a new one.
549
549
  `);
550
550
  }
551
551
  }
552
- //# sourceMappingURL=mcp-auth.js.map
@@ -15,6 +15,7 @@ export declare class AlertManager {
15
15
  private config;
16
16
  private alertHistory;
17
17
  private hourlyAlerts;
18
+ private recentAlerts;
18
19
  private alertsDir;
19
20
  private constructor();
20
21
  /**
@@ -34,7 +35,9 @@ export declare class AlertManager {
34
35
  */
35
36
  private isHourlyLimitExceeded;
36
37
  /**
37
- * Record that an alert was sent
38
+ * Record that an alert was sent. When a severity is provided the alert is
39
+ * also added to the 24h rolling window used for dashboard metrics; internal
40
+ * bookkeeping keys (e.g. the rate-limit warning) omit it.
38
41
  */
39
42
  private recordAlert;
40
43
  /**
@@ -94,6 +97,8 @@ export declare class AlertManager {
94
97
  cooldown_seconds: number;
95
98
  max_alerts_per_hour: number;
96
99
  alerts_this_hour: number;
100
+ alerts_24h: number;
101
+ critical_24h: number;
97
102
  channels: string[];
98
103
  };
99
104
  /**
@@ -117,4 +122,3 @@ export declare function alertCritical(title: string, message: string, source: st
117
122
  * Send a warning alert
118
123
  */
119
124
  export declare function alertWarning(title: string, message: string, source: string, details?: Record<string, unknown>): Promise<Alert | null>;
120
- //# sourceMappingURL=alert-manager.d.ts.map
@@ -18,6 +18,23 @@ import { log } from "../utils/logger.js";
18
18
  function generateUUID() {
19
19
  return crypto.randomUUID();
20
20
  }
21
+ /**
22
+ * Parse webhook headers from environment. Malformed JSON must not throw during
23
+ * singleton construction (which would cascade through every getInstance caller);
24
+ * fall back to no custom headers with a logged warning instead.
25
+ */
26
+ function parseWebhookHeaders() {
27
+ const raw = process.env.NLMCP_ALERTS_WEBHOOK_HEADERS;
28
+ if (!raw)
29
+ return undefined;
30
+ try {
31
+ return JSON.parse(raw);
32
+ }
33
+ catch (err) {
34
+ log.warning(`alert-manager: ignoring malformed NLMCP_ALERTS_WEBHOOK_HEADERS: ${err instanceof Error ? err.message : String(err)}`);
35
+ return undefined;
36
+ }
37
+ }
21
38
  /**
22
39
  * Get alert configuration from environment
23
40
  */
@@ -32,9 +49,7 @@ function getAlertConfig() {
32
49
  } : undefined,
33
50
  webhook: process.env.NLMCP_ALERTS_WEBHOOK_URL ? {
34
51
  url: process.env.NLMCP_ALERTS_WEBHOOK_URL,
35
- headers: process.env.NLMCP_ALERTS_WEBHOOK_HEADERS
36
- ? JSON.parse(process.env.NLMCP_ALERTS_WEBHOOK_HEADERS)
37
- : undefined,
52
+ headers: parseWebhookHeaders(),
38
53
  } : undefined,
39
54
  },
40
55
  min_severity: process.env.NLMCP_ALERTS_MIN_SEVERITY || "warning",
@@ -59,6 +74,8 @@ export class AlertManager {
59
74
  config;
60
75
  alertHistory = new Map(); // key -> last alert timestamp
61
76
  hourlyAlerts = [];
77
+ // 24h rolling window of sent alerts with severity, for dashboard reporting.
78
+ recentAlerts = [];
62
79
  alertsDir;
63
80
  constructor() {
64
81
  this.config = getAlertConfig();
@@ -102,11 +119,19 @@ export class AlertManager {
102
119
  return this.hourlyAlerts.length >= this.config.max_alerts_per_hour;
103
120
  }
104
121
  /**
105
- * Record that an alert was sent
122
+ * Record that an alert was sent. When a severity is provided the alert is
123
+ * also added to the 24h rolling window used for dashboard metrics; internal
124
+ * bookkeeping keys (e.g. the rate-limit warning) omit it.
106
125
  */
107
- recordAlert(key) {
108
- this.alertHistory.set(key, Date.now());
109
- this.hourlyAlerts.push({ timestamp: Date.now() });
126
+ recordAlert(key, severity) {
127
+ const now = Date.now();
128
+ this.alertHistory.set(key, now);
129
+ this.hourlyAlerts.push({ timestamp: now });
130
+ if (severity) {
131
+ const dayAgo = now - 24 * 60 * 60 * 1000;
132
+ this.recentAlerts = this.recentAlerts.filter(a => a.timestamp > dayAgo);
133
+ this.recentAlerts.push({ timestamp: now, severity });
134
+ }
110
135
  }
111
136
  /**
112
137
  * Generate a unique key for deduplication
@@ -167,7 +192,7 @@ export class AlertManager {
167
192
  alert.sent_to.push("webhook");
168
193
  }
169
194
  // Record this alert
170
- this.recordAlert(key);
195
+ this.recordAlert(key, severity);
171
196
  return alert;
172
197
  }
173
198
  /**
@@ -372,14 +397,20 @@ export class AlertManager {
372
397
  channels.push("file");
373
398
  if (this.config.channels.webhook)
374
399
  channels.push("webhook");
375
- const oneHourAgo = Date.now() - 60 * 60 * 1000;
400
+ const now = Date.now();
401
+ const oneHourAgo = now - 60 * 60 * 1000;
402
+ const dayAgo = now - 24 * 60 * 60 * 1000;
376
403
  const alertsThisHour = this.hourlyAlerts.filter(a => a.timestamp > oneHourAgo).length;
404
+ const recent24h = this.recentAlerts.filter(a => a.timestamp > dayAgo);
405
+ const critical24h = recent24h.filter(a => a.severity === "critical").length;
377
406
  return {
378
407
  enabled: this.config.enabled,
379
408
  min_severity: this.config.min_severity,
380
409
  cooldown_seconds: this.config.cooldown_seconds,
381
410
  max_alerts_per_hour: this.config.max_alerts_per_hour,
382
411
  alerts_this_hour: alertsThisHour,
412
+ alerts_24h: recent24h.length,
413
+ critical_24h: critical24h,
383
414
  channels,
384
415
  };
385
416
  }
@@ -420,4 +451,3 @@ export async function alertCritical(title, message, source, details) {
420
451
  export async function alertWarning(title, message, source, details) {
421
452
  return getAlertManager().warning(title, message, source, details);
422
453
  }
423
- //# sourceMappingURL=alert-manager.js.map
@@ -131,4 +131,3 @@ export declare function isPatternBlocked(pattern: string): boolean;
131
131
  */
132
132
  export declare function getBreachRules(): Promise<BreachRule[]>;
133
133
  export {};
134
- //# sourceMappingURL=breach-detection.d.ts.map
@@ -460,4 +460,3 @@ export function isPatternBlocked(pattern) {
460
460
  export async function getBreachRules() {
461
461
  return getBreachDetector().getRules();
462
462
  }
463
- //# sourceMappingURL=breach-detection.js.map
@@ -54,6 +54,19 @@ export declare class ChangeLog {
54
54
  * Get all changes (most recent first)
55
55
  */
56
56
  getAllChanges(limit?: number): Promise<ChangeRecord[]>;
57
+ /**
58
+ * Select monthly log files whose YYYY-MM month overlaps the [from, to] range.
59
+ * Filenames are `changes-YYYY-MM.jsonl`; pushing the date filter into file
60
+ * selection avoids reading (and event-loop-blocking on) years of history when
61
+ * only a narrow report window is requested (L48). Returns newest-first.
62
+ */
63
+ private getLogFilesInRange;
64
+ /**
65
+ * Read change records from a specific set of files, applying an optional
66
+ * date-range predicate. Used by range-bounded queries so only relevant
67
+ * monthly files are read rather than the entire history.
68
+ */
69
+ private readChangesFromFiles;
57
70
  /**
58
71
  * Get high-impact changes
59
72
  */
@@ -110,4 +123,3 @@ export declare function getRecentChanges(limit?: number): Promise<ChangeRecord[]
110
123
  * Get change statistics
111
124
  */
112
125
  export declare function getChangeStatistics(from?: Date, to?: Date): Promise<ReturnType<ChangeLog["getStatistics"]>>;
113
- //# sourceMappingURL=change-log.d.ts.map
@@ -121,13 +121,12 @@ export class ChangeLog {
121
121
  * Get changes within date range
122
122
  */
123
123
  async getChangesInRange(from, to, limit = 1000) {
124
- const changes = await this.getAllChanges(limit * 2);
125
- return changes
126
- .filter(c => {
127
- const date = new Date(c.timestamp);
128
- return date >= from && date <= to;
129
- })
130
- .slice(0, limit);
124
+ // Read only the monthly files overlapping the range (L48) rather than the
125
+ // whole history, then sort most-recent-first to preserve the prior contract.
126
+ const files = this.getLogFilesInRange(from, to);
127
+ const changes = this.readChangesFromFiles(files, from, to);
128
+ changes.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
129
+ return changes.slice(0, limit);
131
130
  }
132
131
  /**
133
132
  * Get all changes (most recent first)
@@ -168,6 +167,77 @@ export class ChangeLog {
168
167
  }
169
168
  return changes;
170
169
  }
170
+ /**
171
+ * Select monthly log files whose YYYY-MM month overlaps the [from, to] range.
172
+ * Filenames are `changes-YYYY-MM.jsonl`; pushing the date filter into file
173
+ * selection avoids reading (and event-loop-blocking on) years of history when
174
+ * only a narrow report window is requested (L48). Returns newest-first.
175
+ */
176
+ getLogFilesInRange(from, to) {
177
+ if (!fs.existsSync(this.logDir))
178
+ return [];
179
+ // Use the same (local-time) month derivation as the filename convention
180
+ // (initializeLogFile/getLogFilePath). Widen the window by one month on each
181
+ // side so a record whose UTC timestamp lands in a file named for an adjacent
182
+ // local month is still considered; readChangesFromFiles applies the exact
183
+ // per-record date predicate, so widening never admits out-of-range records.
184
+ const monthKey = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}`;
185
+ const shiftMonth = (d, delta) => new Date(d.getFullYear(), d.getMonth() + delta, 1);
186
+ const fromKey = from ? monthKey(shiftMonth(from, -1)) : undefined;
187
+ const toKey = to ? monthKey(shiftMonth(to, 1)) : undefined;
188
+ return fs.readdirSync(this.logDir)
189
+ .filter(f => f.startsWith("changes-") && f.endsWith(".jsonl"))
190
+ .filter(f => {
191
+ const month = f.slice("changes-".length, f.length - ".jsonl".length);
192
+ if (!/^\d{4}-\d{2}$/.test(month))
193
+ return false;
194
+ // Inclusive month-boundary comparison (lexicographic works for YYYY-MM).
195
+ if (fromKey && month < fromKey)
196
+ return false;
197
+ if (toKey && month > toKey)
198
+ return false;
199
+ return true;
200
+ })
201
+ .map(f => path.join(this.logDir, f))
202
+ .sort()
203
+ .reverse();
204
+ }
205
+ /**
206
+ * Read change records from a specific set of files, applying an optional
207
+ * date-range predicate. Used by range-bounded queries so only relevant
208
+ * monthly files are read rather than the entire history.
209
+ */
210
+ readChangesFromFiles(files, from, to) {
211
+ const changes = [];
212
+ for (const filePath of files) {
213
+ try {
214
+ const content = fs.readFileSync(filePath, "utf-8");
215
+ const lines = content.trim().split("\n").filter(l => l);
216
+ for (const line of lines) {
217
+ try {
218
+ const record = JSON.parse(line);
219
+ if (from || to) {
220
+ const date = new Date(record.timestamp);
221
+ if (from && date < from)
222
+ continue;
223
+ if (to && date > to)
224
+ continue;
225
+ }
226
+ changes.push(record);
227
+ }
228
+ catch (err) {
229
+ log.debug(`change-log: parse change record line: ${err instanceof Error ? err.message : String(err)}`);
230
+ // Skip malformed lines
231
+ }
232
+ }
233
+ }
234
+ catch (err) {
235
+ log.debug(`change-log: read change log file in range: ${err instanceof Error ? err.message : String(err)}`);
236
+ // Skip unreadable files
237
+ }
238
+ }
239
+ return changes;
240
+ }
171
241
  /**
172
242
  * Get high-impact changes
173
243
  */
@@ -197,14 +267,11 @@ export class ChangeLog {
197
267
  * Get change statistics
198
268
  */
199
269
  async getStatistics(from, to) {
200
- const allChanges = await this.getAllChanges(10000);
201
- let changes = allChanges;
202
- if (from) {
203
- changes = changes.filter(c => new Date(c.timestamp) >= from);
204
- }
205
- if (to) {
206
- changes = changes.filter(c => new Date(c.timestamp) <= to);
207
- }
270
+ // Read only the monthly files overlapping [from, to] and apply the exact
271
+ // date predicate per record, instead of slurping the entire 7-year history
272
+ // and filtering in memory (L48).
273
+ const files = this.getLogFilesInRange(from, to);
274
+ const changes = this.readChangesFromFiles(files, from, to);
208
275
  const byComponent = {};
209
276
  const byImpact = {};
210
277
  const byMethod = {};
@@ -275,4 +342,3 @@ export async function getRecentChanges(limit = 100) {
275
342
  export async function getChangeStatistics(from, to) {
276
343
  return getChangeLog().getStatistics(from, to);
277
344
  }
278
- //# sourceMappingURL=change-log.js.map
@@ -30,7 +30,20 @@ export declare class ComplianceLogger {
30
30
  */
31
31
  private getLogFilePath;
32
32
  /**
33
- * Load the last hash from the current log file
33
+ * Read the last event's hash from a specific log file, or null if the file is
34
+ * absent/empty/unreadable.
35
+ */
36
+ private readLastHashFromFile;
37
+ /**
38
+ * Return the last hash from the most recent monthly file before the current
39
+ * one, so a fresh month seeds its chain from the prior month rather than
40
+ * forking a new chain at month rollover (L49).
41
+ */
42
+ private findPreviousMonthLastHash;
43
+ /**
44
+ * Load the last hash to continue the chain. Prefer the current month's file;
45
+ * if it is empty/absent (month rollover), seed from the previous month's last
46
+ * hash so cross-month gaps don't fork the chain and trigger a false tamper signal.
34
47
  */
35
48
  private loadLastHash;
36
49
  /**
@@ -38,7 +51,15 @@ export declare class ComplianceLogger {
38
51
  */
39
52
  private createEvent;
40
53
  /**
41
- * Write event to log file
54
+ * Write event to log file.
55
+ *
56
+ * The chain link (previous_hash), hash computation, append, and lastHash
57
+ * advance all happen inside a single withLock critical section so that
58
+ * concurrent processes / calls serialize their appends and never fork the
59
+ * hash chain (L49, mirrors audit-logger H20). The on-disk tail is treated as
60
+ * the source of truth for previous_hash, re-seeding from the file (including a
61
+ * prior-month seed on rollover) so a stale in-memory pointer cannot break the
62
+ * chain after another process appended.
42
63
  */
43
64
  private writeEvent;
44
65
  /**
@@ -106,6 +127,12 @@ export declare class ComplianceLogger {
106
127
  totalEvents: number;
107
128
  validEvents: number;
108
129
  }>;
130
+ /**
131
+ * Return the current in-memory chain head (hash of the last event this process
132
+ * wrote, or the seeded value at startup). Diagnostic only — writeEvent always
133
+ * re-reads the authoritative tail from disk under lock before linking (L49).
134
+ */
135
+ getChainHead(): string;
109
136
  /**
110
137
  * Get compliance log statistics
111
138
  */
@@ -133,4 +160,3 @@ export declare function logComplianceEvent(category: ComplianceEventCategory, ev
133
160
  retentionDays?: number;
134
161
  failureReason?: string;
135
162
  }): Promise<ComplianceEvent>;
136
- //# sourceMappingURL=compliance-logger.d.ts.map
@@ -10,6 +10,7 @@ import crypto from "crypto";
10
10
  import path from "path";
11
11
  import fs from "fs";
12
12
  import { mkdirSecure, appendFileSecure } from "../utils/file-permissions.js";
13
+ import { withLock } from "../utils/file-lock.js";
13
14
  import { log } from "../utils/logger.js";
14
15
  import { CONFIG } from "../config.js";
15
16
  /**
@@ -96,26 +97,65 @@ export class ComplianceLogger {
96
97
  return path.join(this.complianceDir, `events-${year}-${month}.jsonl`);
97
98
  }
98
99
  /**
99
- * Load the last hash from the current log file
100
+ * Read the last event's hash from a specific log file, or null if the file is
101
+ * absent/empty/unreadable.
100
102
  */
101
- loadLastHash() {
103
+ readLastHashFromFile(logPath) {
102
104
  try {
103
- const logPath = this.getLogFilePath();
104
- if (fs.existsSync(logPath)) {
105
- const content = fs.readFileSync(logPath, "utf-8");
106
- const lines = content.trim().split("\n").filter(line => line);
107
- if (lines.length > 0) {
108
- const lastLine = lines[lines.length - 1];
109
- const lastEvent = JSON.parse(lastLine);
110
- this.lastHash = lastEvent.hash;
111
- }
105
+ if (!fs.existsSync(logPath))
106
+ return null;
107
+ const content = fs.readFileSync(logPath, "utf-8");
108
+ const lines = content.trim().split("\n").filter(line => line);
109
+ if (lines.length === 0)
110
+ return null;
111
+ const lastEvent = JSON.parse(lines[lines.length - 1]);
112
+ return typeof lastEvent.hash === "string" && lastEvent.hash.length > 0
113
+ ? lastEvent.hash
114
+ : null;
115
+ }
116
+ catch (err) {
117
+ log.debug(`compliance-logger: readLastHashFromFile read log file: ${err instanceof Error ? err.message : String(err)}`);
118
+ return null;
119
+ }
120
+ }
121
+ /**
122
+ * Return the last hash from the most recent monthly file before the current
123
+ * one, so a fresh month seeds its chain from the prior month rather than
124
+ * forking a new chain at month rollover (L49).
125
+ */
126
+ findPreviousMonthLastHash() {
127
+ try {
128
+ if (!fs.existsSync(this.complianceDir))
129
+ return null;
130
+ const currentFile = path.basename(this.getLogFilePath());
131
+ const candidates = fs.readdirSync(this.complianceDir)
132
+ .filter(f => f.startsWith("events-") && f.endsWith(".jsonl") && f < currentFile)
133
+ .sort()
134
+ .reverse(); // most recent prior month first
135
+ for (const f of candidates) {
136
+ const hash = this.readLastHashFromFile(path.join(this.complianceDir, f));
137
+ if (hash)
138
+ return hash;
112
139
  }
113
140
  }
114
141
  catch (err) {
115
- log.debug(`compliance-logger: loadLastHash read log file: ${err instanceof Error ? err.message : String(err)}`);
116
- // If we can't read the hash, start fresh
117
- this.lastHash = "0".repeat(64);
142
+ log.debug(`compliance-logger: findPreviousMonthLastHash: ${err instanceof Error ? err.message : String(err)}`);
118
143
  }
144
+ return null;
145
+ }
146
+ /**
147
+ * Load the last hash to continue the chain. Prefer the current month's file;
148
+ * if it is empty/absent (month rollover), seed from the previous month's last
149
+ * hash so cross-month gaps don't fork the chain and trigger a false tamper signal.
150
+ */
151
+ loadLastHash() {
152
+ const current = this.readLastHashFromFile(this.getLogFilePath());
153
+ if (current) {
154
+ this.lastHash = current;
155
+ return;
156
+ }
157
+ const prevMonth = this.findPreviousMonthLastHash();
158
+ this.lastHash = prevMonth || "0".repeat(64);
119
159
  }
120
160
  /**
121
161
  * Create a compliance event
@@ -139,27 +179,43 @@ export class ComplianceLogger {
139
179
  retention_days: options.retentionDays || this.retentionYears * 365,
140
180
  outcome,
141
181
  failure_reason: options.failureReason,
142
- hash: "", // Will be computed
143
- previous_hash: this.lastHash,
182
+ // previous_hash and hash are intentionally left blank here. They are stamped
183
+ // inside writeEvent's lock so concurrent log() calls and other processes
184
+ // cannot read the same this.lastHash and fork the chain (L49, mirrors H20).
185
+ hash: "",
186
+ previous_hash: "",
144
187
  };
145
- // Compute hash (exclude hash field itself)
146
- const hashInput = JSON.stringify({
147
- ...event,
148
- hash: undefined,
149
- });
150
- event.hash = computeHash(hashInput);
151
- this.lastHash = event.hash;
152
188
  return event;
153
189
  }
154
190
  /**
155
- * Write event to log file
191
+ * Write event to log file.
192
+ *
193
+ * The chain link (previous_hash), hash computation, append, and lastHash
194
+ * advance all happen inside a single withLock critical section so that
195
+ * concurrent processes / calls serialize their appends and never fork the
196
+ * hash chain (L49, mirrors audit-logger H20). The on-disk tail is treated as
197
+ * the source of truth for previous_hash, re-seeding from the file (including a
198
+ * prior-month seed on rollover) so a stale in-memory pointer cannot break the
199
+ * chain after another process appended.
156
200
  */
157
201
  async writeEvent(event) {
158
202
  if (!this.enabled)
159
203
  return;
160
204
  const logPath = this.getLogFilePath();
161
- const line = JSON.stringify(event) + "\n";
162
- appendFileSecure(logPath, line);
205
+ await withLock(logPath, async () => {
206
+ // Re-read the authoritative tail under the lock so the chain links from
207
+ // whatever was actually last written (by this or any other process).
208
+ const diskHash = this.readLastHashFromFile(logPath)
209
+ ?? this.findPreviousMonthLastHash()
210
+ ?? "0".repeat(64);
211
+ event.previous_hash = diskHash;
212
+ const hashInput = JSON.stringify({ ...event, hash: undefined });
213
+ event.hash = computeHash(hashInput);
214
+ const line = JSON.stringify(event) + "\n";
215
+ appendFileSecure(logPath, line);
216
+ // Advance the in-memory pointer only after the write succeeds.
217
+ this.lastHash = event.hash;
218
+ });
163
219
  }
164
220
  /**
165
221
  * Log a compliance event
@@ -362,6 +418,14 @@ export class ComplianceLogger {
362
418
  validEvents,
363
419
  };
364
420
  }
421
+ /**
422
+ * Return the current in-memory chain head (hash of the last event this process
423
+ * wrote, or the seeded value at startup). Diagnostic only — writeEvent always
424
+ * re-reads the authoritative tail from disk under lock before linking (L49).
425
+ */
426
+ getChainHead() {
427
+ return this.lastHash;
428
+ }
365
429
  /**
366
430
  * Get compliance log statistics
367
431
  */
@@ -427,4 +491,3 @@ export function getComplianceLogger() {
427
491
  export async function logComplianceEvent(category, eventType, actor, outcome, options) {
428
492
  return getComplianceLogger().log(category, eventType, actor, outcome, options);
429
493
  }
430
- //# sourceMappingURL=compliance-logger.js.map
@@ -15,4 +15,3 @@ export declare function getComplianceTools(): Tool[];
15
15
  * Handle compliance tool calls
16
16
  */
17
17
  export declare function handleComplianceToolCall(toolName: string, args: Record<string, unknown>): Promise<TextContent[]>;
18
- //# sourceMappingURL=compliance-tools.d.ts.map
@@ -695,4 +695,3 @@ async function handleGetPolicy(args) {
695
695
  }
696
696
  return [{ type: "text", text: JSON.stringify(policy, null, 2) }];
697
697
  }
698
- //# sourceMappingURL=compliance-tools.js.map
@@ -127,4 +127,3 @@ export declare function grantConsent(purposes: ConsentPurpose[], options?: {
127
127
  * Revoke a consent
128
128
  */
129
129
  export declare function revokeConsent(consentId: string, reason?: string): Promise<boolean>;
130
- //# sourceMappingURL=consent-manager.d.ts.map
@@ -385,4 +385,3 @@ export async function grantConsent(purposes, options) {
385
385
  export async function revokeConsent(consentId, reason) {
386
386
  return getConsentManager().revokeConsent(consentId, reason);
387
387
  }
388
- //# sourceMappingURL=consent-manager.js.map
@@ -66,7 +66,8 @@ interface SOC2Dashboard {
66
66
  status: "compliant" | "at_risk" | "non_compliant";
67
67
  availability: {
68
68
  current_status: string;
69
- uptime_percentage: number;
69
+ uptime_percentage: number | null;
70
+ uptime_percentage_measured: boolean;
70
71
  last_incident?: string;
71
72
  };
72
73
  security: {
@@ -123,7 +124,8 @@ interface SecurityDashboard {
123
124
  alerts: {
124
125
  total_24h: number;
125
126
  critical_24h: number;
126
- unacknowledged: number;
127
+ unacknowledged: number | null;
128
+ unacknowledged_tracked: boolean;
127
129
  };
128
130
  breach_detection: {
129
131
  enabled: boolean;
@@ -240,4 +242,3 @@ export declare function getComplianceScore(): Promise<ReturnType<ComplianceDashb
240
242
  */
241
243
  export declare function getDashboardCLI(): Promise<string>;
242
244
  export {};
243
- //# sourceMappingURL=dashboard.d.ts.map
@@ -185,9 +185,9 @@ export class ComplianceDashboard {
185
185
  // Get logging status
186
186
  const loggerStats = await complianceLogger.getStats();
187
187
  const integrity = await complianceLogger.verifyIntegrity();
188
- // Calculate uptime (simplified - would need more sophisticated tracking)
189
- const uptimePercentage = metrics?.status === "healthy" ? 99.9 :
190
- metrics?.status === "degraded" ? 95.0 : 90.0;
188
+ // Availability percentage is intentionally NOT computed: there is no
189
+ // downtime/incident-duration tracking, so any number here would be a
190
+ // fabricated SOC2 metric. Report null + measured=false instead.
191
191
  // Determine status
192
192
  let status = "compliant";
193
193
  if (!security.encryption_enabled || openIncidents.length > 0) {
@@ -200,7 +200,8 @@ export class ComplianceDashboard {
200
200
  status,
201
201
  availability: {
202
202
  current_status: metrics?.status || "unknown",
203
- uptime_percentage: uptimePercentage,
203
+ uptime_percentage: null,
204
+ uptime_percentage_measured: false,
204
205
  last_incident: lastIncident,
205
206
  },
206
207
  security: {
@@ -301,9 +302,12 @@ export class ComplianceDashboard {
301
302
  by_type: incidentStats.by_type,
302
303
  },
303
304
  alerts: {
304
- total_24h: alertStats.alerts_this_hour * 24, // Estimate
305
- critical_24h: 0, // Not tracked by alert manager
306
- unacknowledged: 0, // Alert manager doesn't track acknowledgments
305
+ // Real 24h counts from AlertManager's rolling window (not an estimate).
306
+ total_24h: alertStats.alerts_24h,
307
+ critical_24h: alertStats.critical_24h,
308
+ // No acknowledgment model exists — report not-tracked rather than a fake 0.
309
+ unacknowledged: null,
310
+ unacknowledged_tracked: false,
307
311
  },
308
312
  breach_detection: {
309
313
  enabled: true,
@@ -516,4 +520,3 @@ export async function getComplianceScore() {
516
520
  export async function getDashboardCLI() {
517
521
  return getComplianceDashboard().getSummaryForCLI();
518
522
  }
519
- //# sourceMappingURL=dashboard.js.map
@@ -114,4 +114,3 @@ export declare function isExportable(dataType: string): boolean;
114
114
  * Check if data can be erased for GDPR
115
115
  */
116
116
  export declare function isErasable(dataType: string): boolean;
117
- //# sourceMappingURL=data-classification.d.ts.map
@@ -466,4 +466,3 @@ export function isExportable(dataType) {
466
466
  export function isErasable(dataType) {
467
467
  return getDataClassifier().isErasable(dataType);
468
468
  }
469
- //# sourceMappingURL=data-classification.js.map
@@ -107,4 +107,3 @@ export declare function executeErasureRequest(requestId: string): Promise<Erasur
107
107
  * Get pending erasure requests
108
108
  */
109
109
  export declare function getPendingErasureRequests(): Promise<ErasureRequest[]>;
110
- //# sourceMappingURL=data-erasure.d.ts.map
@@ -557,4 +557,3 @@ export async function executeErasureRequest(requestId) {
557
557
  export async function getPendingErasureRequests() {
558
558
  return getDataErasureManager().getPendingRequests();
559
559
  }
560
- //# sourceMappingURL=data-erasure.js.map