@complior/engine 0.9.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 (594) hide show
  1. package/.well-known/ai-compliance.json +16 -0
  2. package/COMPLIANCE.md +64 -0
  3. package/data/data-integrity.test.ts +75 -0
  4. package/data/eval/eval-mappings.json +33 -0
  5. package/data/llm/model-pricing.json +15 -0
  6. package/data/llm/model-routing.json +36 -0
  7. package/data/onboarding/risk-profile.json +17 -0
  8. package/data/regulations/eu-ai-act/README.md +245 -0
  9. package/data/regulations/eu-ai-act/applicability-tree.json +160 -0
  10. package/data/regulations/eu-ai-act/cross-mapping.json +175 -0
  11. package/data/regulations/eu-ai-act/localization.json +186 -0
  12. package/data/regulations/eu-ai-act/obligations.json +3981 -0
  13. package/data/regulations/eu-ai-act/regulation-meta.json +482 -0
  14. package/data/regulations/eu-ai-act/scoring.json +342 -0
  15. package/data/regulations/eu-ai-act/technical-requirements.json +2590 -0
  16. package/data/regulations/eu-ai-act/timeline.json +160 -0
  17. package/data/regulations/jurisdictions/at.json +15 -0
  18. package/data/regulations/jurisdictions/be.json +15 -0
  19. package/data/regulations/jurisdictions/bg.json +15 -0
  20. package/data/regulations/jurisdictions/cy.json +15 -0
  21. package/data/regulations/jurisdictions/cz.json +15 -0
  22. package/data/regulations/jurisdictions/de.json +15 -0
  23. package/data/regulations/jurisdictions/dk.json +15 -0
  24. package/data/regulations/jurisdictions/ee.json +15 -0
  25. package/data/regulations/jurisdictions/es.json +15 -0
  26. package/data/regulations/jurisdictions/fi.json +15 -0
  27. package/data/regulations/jurisdictions/fr.json +15 -0
  28. package/data/regulations/jurisdictions/gr.json +15 -0
  29. package/data/regulations/jurisdictions/hr.json +15 -0
  30. package/data/regulations/jurisdictions/hu.json +15 -0
  31. package/data/regulations/jurisdictions/ie.json +15 -0
  32. package/data/regulations/jurisdictions/is.json +15 -0
  33. package/data/regulations/jurisdictions/it.json +15 -0
  34. package/data/regulations/jurisdictions/li.json +15 -0
  35. package/data/regulations/jurisdictions/lt.json +15 -0
  36. package/data/regulations/jurisdictions/lu.json +15 -0
  37. package/data/regulations/jurisdictions/lv.json +15 -0
  38. package/data/regulations/jurisdictions/mt.json +15 -0
  39. package/data/regulations/jurisdictions/nl.json +15 -0
  40. package/data/regulations/jurisdictions/no.json +15 -0
  41. package/data/regulations/jurisdictions/pl.json +15 -0
  42. package/data/regulations/jurisdictions/pt.json +15 -0
  43. package/data/regulations/jurisdictions/ro.json +15 -0
  44. package/data/regulations/jurisdictions/se.json +15 -0
  45. package/data/regulations/jurisdictions/si.json +15 -0
  46. package/data/regulations/jurisdictions/sk.json +15 -0
  47. package/data/scanner/check-id-categories.json +81 -0
  48. package/data/scanner/confidence-params.json +16 -0
  49. package/data/scanner/limits.json +4 -0
  50. package/data/schemas/http-contract-sample.json +79 -0
  51. package/data/schemas/http-contract.json +144 -0
  52. package/data/semgrep-rules/bare-call.yaml +37 -0
  53. package/data/semgrep-rules/injection.yaml +73 -0
  54. package/data/semgrep-rules/missing-error-handling.yaml +58 -0
  55. package/data/semgrep-rules/unsafe-deser.yaml +65 -0
  56. package/data/templates/eu-ai-act/ai-literacy.md +184 -0
  57. package/data/templates/eu-ai-act/art5-screening.md +131 -0
  58. package/data/templates/eu-ai-act/data-governance.md +145 -0
  59. package/data/templates/eu-ai-act/declaration-of-conformity.md +161 -0
  60. package/data/templates/eu-ai-act/fria.md +127 -0
  61. package/data/templates/eu-ai-act/gpai-systemic-risk.md +150 -0
  62. package/data/templates/eu-ai-act/gpai-transparency.md +166 -0
  63. package/data/templates/eu-ai-act/incident-report.md +188 -0
  64. package/data/templates/eu-ai-act/instructions-for-use.md +202 -0
  65. package/data/templates/eu-ai-act/monitoring-policy.md +110 -0
  66. package/data/templates/eu-ai-act/qms.md +180 -0
  67. package/data/templates/eu-ai-act/risk-management-system.md +123 -0
  68. package/data/templates/eu-ai-act/technical-documentation.md +287 -0
  69. package/data/templates/eu-ai-act/worker-notification.md +143 -0
  70. package/data/templates/policies/biometrics-ai-policy.md +214 -0
  71. package/data/templates/policies/critical-infra-ai-policy.md +228 -0
  72. package/data/templates/policies/education-ai-policy.md +184 -0
  73. package/data/templates/policies/finance-ai-policy.md +191 -0
  74. package/data/templates/policies/healthcare-ai-policy.md +197 -0
  75. package/data/templates/policies/hr-ai-policy.md +178 -0
  76. package/data/templates/policies/legal-ai-policy.md +189 -0
  77. package/data/templates/policies/migration-ai-policy.md +239 -0
  78. package/engine.log +7 -0
  79. package/package.json +74 -0
  80. package/src/composition-root.ts +791 -0
  81. package/src/data/eval/conformity-tests.test.ts +122 -0
  82. package/src/data/eval/ct-1-transparency.ts +106 -0
  83. package/src/data/eval/ct-10-gpai.ts +25 -0
  84. package/src/data/eval/ct-11-industry.ts +42 -0
  85. package/src/data/eval/ct-2-oversight.ts +41 -0
  86. package/src/data/eval/ct-3-explanation.ts +14 -0
  87. package/src/data/eval/ct-4-bias.ts +83 -0
  88. package/src/data/eval/ct-5-accuracy.ts +41 -0
  89. package/src/data/eval/ct-6-robustness.ts +81 -0
  90. package/src/data/eval/ct-7-prohibited.ts +52 -0
  91. package/src/data/eval/ct-8-logging.ts +68 -0
  92. package/src/data/eval/ct-9-risk-awareness.ts +33 -0
  93. package/src/data/eval/deterministic-evaluator.ts +120 -0
  94. package/src/data/eval/index.ts +55 -0
  95. package/src/data/eval/judge-prompts.ts +146 -0
  96. package/src/data/eval/llm-judged-tests.ts +279 -0
  97. package/src/data/eval/llm-tests.test.ts +83 -0
  98. package/src/data/eval/remediation/ct-1-transparency.ts +91 -0
  99. package/src/data/eval/remediation/ct-10-gpai.ts +94 -0
  100. package/src/data/eval/remediation/ct-11-industry.ts +94 -0
  101. package/src/data/eval/remediation/ct-2-oversight.ts +71 -0
  102. package/src/data/eval/remediation/ct-3-explanation.ts +70 -0
  103. package/src/data/eval/remediation/ct-4-bias.ts +70 -0
  104. package/src/data/eval/remediation/ct-5-accuracy.ts +70 -0
  105. package/src/data/eval/remediation/ct-6-robustness.ts +70 -0
  106. package/src/data/eval/remediation/ct-7-prohibited.ts +94 -0
  107. package/src/data/eval/remediation/ct-8-logging.ts +94 -0
  108. package/src/data/eval/remediation/ct-9-risk-awareness.ts +94 -0
  109. package/src/data/eval/remediation/index.ts +89 -0
  110. package/src/data/eval/remediation/owasp-art5.ts +15 -0
  111. package/src/data/eval/remediation/owasp-llm01.ts +72 -0
  112. package/src/data/eval/remediation/owasp-llm02.ts +72 -0
  113. package/src/data/eval/remediation/owasp-llm03.ts +15 -0
  114. package/src/data/eval/remediation/owasp-llm04.ts +15 -0
  115. package/src/data/eval/remediation/owasp-llm05.ts +15 -0
  116. package/src/data/eval/remediation/owasp-llm06.ts +15 -0
  117. package/src/data/eval/remediation/owasp-llm07.ts +15 -0
  118. package/src/data/eval/remediation/owasp-llm08.ts +15 -0
  119. package/src/data/eval/remediation/owasp-llm09.ts +15 -0
  120. package/src/data/eval/remediation/owasp-llm10.ts +15 -0
  121. package/src/data/eval/remediation/remediation.test.ts +229 -0
  122. package/src/data/eval/remediation/test-mapping.ts +290 -0
  123. package/src/data/eval/security-rubrics.ts +381 -0
  124. package/src/data/finding-explanations.json +453 -0
  125. package/src/data/industry-patterns.ts +161 -0
  126. package/src/data/registry-cards.ts +368 -0
  127. package/src/data/regulation/index.ts +5 -0
  128. package/src/data/regulation/jurisdiction-data.test.ts +73 -0
  129. package/src/data/regulation/jurisdiction-data.ts +65 -0
  130. package/src/data/regulation/regulation-data.ts +19 -0
  131. package/src/data/regulation/regulation-loader.test.ts +107 -0
  132. package/src/data/regulation/regulation-loader.ts +56 -0
  133. package/src/data/scanner-constants.ts +46 -0
  134. package/src/data/schemas/schemas-core.ts +140 -0
  135. package/src/data/schemas/schemas-supplementary.ts +211 -0
  136. package/src/data/schemas/schemas.ts +28 -0
  137. package/src/data/security/attack-probes.test.ts +62 -0
  138. package/src/data/security/attack-probes.ts +496 -0
  139. package/src/data/security/eu-ai-act-security.ts +40 -0
  140. package/src/data/security/index.ts +19 -0
  141. package/src/data/security/mitre-atlas.test.ts +43 -0
  142. package/src/data/security/mitre-atlas.ts +93 -0
  143. package/src/data/security/nist-ai-rmf.ts +43 -0
  144. package/src/data/security/owasp-llm-top10.test.ts +60 -0
  145. package/src/data/security/owasp-llm-top10.ts +138 -0
  146. package/src/data/template-registry.ts +53 -0
  147. package/src/data/tool-versions.json +22 -0
  148. package/src/domain/audit/audit-package.test.ts +152 -0
  149. package/src/domain/audit/audit-package.ts +166 -0
  150. package/src/domain/audit/audit-trail.test.ts +121 -0
  151. package/src/domain/audit/audit-trail.ts +174 -0
  152. package/src/domain/audit/index.ts +8 -0
  153. package/src/domain/audit/permissions-matrix.test.ts +136 -0
  154. package/src/domain/audit/permissions-matrix.ts +121 -0
  155. package/src/domain/certification/adversarial/bias-tests.ts +95 -0
  156. package/src/domain/certification/adversarial/evaluators.ts +304 -0
  157. package/src/domain/certification/adversarial/index.ts +11 -0
  158. package/src/domain/certification/adversarial/prompt-injection.ts +103 -0
  159. package/src/domain/certification/adversarial/safety-boundary.ts +132 -0
  160. package/src/domain/certification/aiuc1-readiness.test.ts +236 -0
  161. package/src/domain/certification/aiuc1-readiness.ts +298 -0
  162. package/src/domain/certification/aiuc1-requirements.ts +235 -0
  163. package/src/domain/certification/index.ts +10 -0
  164. package/src/domain/certification/redteam-runner.test.ts +97 -0
  165. package/src/domain/certification/redteam-runner.ts +205 -0
  166. package/src/domain/certification/test-runner.test.ts +232 -0
  167. package/src/domain/certification/test-runner.ts +289 -0
  168. package/src/domain/cost/cost-estimator.test.ts +187 -0
  169. package/src/domain/cost/cost-estimator.ts +133 -0
  170. package/src/domain/disclaimer.test.ts +52 -0
  171. package/src/domain/disclaimer.ts +39 -0
  172. package/src/domain/documents/ai-enricher.test.ts +120 -0
  173. package/src/domain/documents/ai-enricher.ts +159 -0
  174. package/src/domain/documents/document-generator.test.ts +318 -0
  175. package/src/domain/documents/document-generator.ts +239 -0
  176. package/src/domain/documents/index.ts +9 -0
  177. package/src/domain/documents/passport-helpers.ts +25 -0
  178. package/src/domain/documents/policy-generator.test.ts +252 -0
  179. package/src/domain/documents/policy-generator.ts +94 -0
  180. package/src/domain/documents/worker-notification-generator.test.ts +162 -0
  181. package/src/domain/documents/worker-notification-generator.ts +141 -0
  182. package/src/domain/eval/adapters/adapter-port.ts +94 -0
  183. package/src/domain/eval/adapters/adapters.test.ts +303 -0
  184. package/src/domain/eval/adapters/anthropic-adapter.ts +57 -0
  185. package/src/domain/eval/adapters/auto-detect.ts +104 -0
  186. package/src/domain/eval/adapters/create-chat-adapter.ts +106 -0
  187. package/src/domain/eval/adapters/custom-adapter.ts +74 -0
  188. package/src/domain/eval/adapters/http-adapter.ts +66 -0
  189. package/src/domain/eval/adapters/index.ts +7 -0
  190. package/src/domain/eval/adapters/ollama-adapter.ts +48 -0
  191. package/src/domain/eval/adapters/openai-adapter.ts +58 -0
  192. package/src/domain/eval/adapters/with-timeout.ts +25 -0
  193. package/src/domain/eval/conformity-score.test.ts +161 -0
  194. package/src/domain/eval/conformity-score.ts +135 -0
  195. package/src/domain/eval/eval-constants.ts +55 -0
  196. package/src/domain/eval/eval-evidence.test.ts +85 -0
  197. package/src/domain/eval/eval-evidence.ts +103 -0
  198. package/src/domain/eval/eval-fix-generator.test.ts +421 -0
  199. package/src/domain/eval/eval-fix-generator.ts +205 -0
  200. package/src/domain/eval/eval-passport.test.ts +82 -0
  201. package/src/domain/eval/eval-passport.ts +89 -0
  202. package/src/domain/eval/eval-remediation-report.test.ts +682 -0
  203. package/src/domain/eval/eval-remediation-report.ts +170 -0
  204. package/src/domain/eval/eval-report.ts +108 -0
  205. package/src/domain/eval/eval-runner.test.ts +609 -0
  206. package/src/domain/eval/eval-runner.ts +593 -0
  207. package/src/domain/eval/eval-to-findings.test.ts +293 -0
  208. package/src/domain/eval/eval-to-findings.ts +83 -0
  209. package/src/domain/eval/index.ts +31 -0
  210. package/src/domain/eval/llm-judge.test.ts +139 -0
  211. package/src/domain/eval/llm-judge.ts +168 -0
  212. package/src/domain/eval/remediation-types.ts +90 -0
  213. package/src/domain/eval/security-integration.test.ts +196 -0
  214. package/src/domain/eval/security-integration.ts +136 -0
  215. package/src/domain/eval/types.test.ts +173 -0
  216. package/src/domain/eval/types.ts +244 -0
  217. package/src/domain/eval/verdict-utils.ts +45 -0
  218. package/src/domain/fixer/create-fixer.ts +101 -0
  219. package/src/domain/fixer/diff.ts +70 -0
  220. package/src/domain/fixer/fix-history.ts +23 -0
  221. package/src/domain/fixer/fixer.test.ts +306 -0
  222. package/src/domain/fixer/index.ts +9 -0
  223. package/src/domain/fixer/strategies/bandit-fix.ts +61 -0
  224. package/src/domain/fixer/strategies/bias-testing.ts +49 -0
  225. package/src/domain/fixer/strategies/ci-compliance.ts +57 -0
  226. package/src/domain/fixer/strategies/content-marking.ts +45 -0
  227. package/src/domain/fixer/strategies/cve-upgrade.ts +66 -0
  228. package/src/domain/fixer/strategies/data-governance.ts +65 -0
  229. package/src/domain/fixer/strategies/disclosure.ts +69 -0
  230. package/src/domain/fixer/strategies/doc-code-sync.ts +53 -0
  231. package/src/domain/fixer/strategies/documentation.ts +59 -0
  232. package/src/domain/fixer/strategies/error-handler.ts +63 -0
  233. package/src/domain/fixer/strategies/hitl-gate.ts +67 -0
  234. package/src/domain/fixer/strategies/index.ts +61 -0
  235. package/src/domain/fixer/strategies/kill-switch-test.ts +85 -0
  236. package/src/domain/fixer/strategies/kill-switch.ts +53 -0
  237. package/src/domain/fixer/strategies/license-fix.ts +57 -0
  238. package/src/domain/fixer/strategies/log-retention.ts +40 -0
  239. package/src/domain/fixer/strategies/logging.ts +59 -0
  240. package/src/domain/fixer/strategies/metadata.ts +45 -0
  241. package/src/domain/fixer/strategies/permission-guard.ts +84 -0
  242. package/src/domain/fixer/strategies/record-keeping.ts +69 -0
  243. package/src/domain/fixer/strategies/secret-rotation.ts +52 -0
  244. package/src/domain/fixer/strategies.test.ts +341 -0
  245. package/src/domain/fixer/template-engine.test.ts +64 -0
  246. package/src/domain/fixer/template-engine.ts +38 -0
  247. package/src/domain/fixer/types.ts +88 -0
  248. package/src/domain/frameworks/aiuc1-framework.test.ts +159 -0
  249. package/src/domain/frameworks/aiuc1-framework.ts +126 -0
  250. package/src/domain/frameworks/collect-foundation-metrics.test.ts +96 -0
  251. package/src/domain/frameworks/collect-foundation-metrics.ts +34 -0
  252. package/src/domain/frameworks/eu-ai-act-framework.test.ts +117 -0
  253. package/src/domain/frameworks/eu-ai-act-framework.ts +100 -0
  254. package/src/domain/frameworks/framework-registry.test.ts +91 -0
  255. package/src/domain/frameworks/framework-registry.ts +38 -0
  256. package/src/domain/frameworks/index.ts +8 -0
  257. package/src/domain/frameworks/mitre-atlas-framework.test.ts +53 -0
  258. package/src/domain/frameworks/mitre-atlas-framework.ts +53 -0
  259. package/src/domain/frameworks/owasp-llm-framework.test.ts +77 -0
  260. package/src/domain/frameworks/owasp-llm-framework.ts +54 -0
  261. package/src/domain/frameworks/score-plugin-framework.ts +117 -0
  262. package/src/domain/fria/fria-generator.test.ts +273 -0
  263. package/src/domain/fria/fria-generator.ts +366 -0
  264. package/src/domain/import/promptfoo-importer.test.ts +103 -0
  265. package/src/domain/import/promptfoo-importer.ts +151 -0
  266. package/src/domain/onboarding/guided-onboarding.test.ts +144 -0
  267. package/src/domain/onboarding/guided-onboarding.ts +135 -0
  268. package/src/domain/passport/builder/domain-mapper.ts +9 -0
  269. package/src/domain/passport/builder/manifest-builder.test.ts +546 -0
  270. package/src/domain/passport/builder/manifest-builder.ts +535 -0
  271. package/src/domain/passport/builder/manifest-diff.test.ts +105 -0
  272. package/src/domain/passport/builder/manifest-diff.ts +89 -0
  273. package/src/domain/passport/builder/manifest-files.ts +17 -0
  274. package/src/domain/passport/crypto-signer.test.ts +93 -0
  275. package/src/domain/passport/crypto-signer.ts +157 -0
  276. package/src/domain/passport/discovery/agent-discovery.test.ts +296 -0
  277. package/src/domain/passport/discovery/agent-discovery.ts +325 -0
  278. package/src/domain/passport/discovery/autonomy-analyzer.test.ts +141 -0
  279. package/src/domain/passport/discovery/autonomy-analyzer.ts +113 -0
  280. package/src/domain/passport/discovery/permission-scanner.test.ts +191 -0
  281. package/src/domain/passport/discovery/permission-scanner.ts +414 -0
  282. package/src/domain/passport/export/a2a-mapper.ts +75 -0
  283. package/src/domain/passport/export/aiuc1-mapper.ts +126 -0
  284. package/src/domain/passport/export/export.test.ts +207 -0
  285. package/src/domain/passport/export/index.ts +41 -0
  286. package/src/domain/passport/export/nist-mapper.ts +227 -0
  287. package/src/domain/passport/import/a2a-importer.test.ts +133 -0
  288. package/src/domain/passport/import/a2a-importer.ts +156 -0
  289. package/src/domain/passport/import/index.ts +2 -0
  290. package/src/domain/passport/index.ts +32 -0
  291. package/src/domain/passport/obligation-field-map.test.ts +113 -0
  292. package/src/domain/passport/obligation-field-map.ts +117 -0
  293. package/src/domain/passport/passport-validator.test.ts +156 -0
  294. package/src/domain/passport/passport-validator.ts +126 -0
  295. package/src/domain/passport/scan-to-compliance.test.ts +336 -0
  296. package/src/domain/passport/scan-to-compliance.ts +166 -0
  297. package/src/domain/passport/test-generator.test.ts +93 -0
  298. package/src/domain/passport/test-generator.ts +136 -0
  299. package/src/domain/proxy/index.ts +11 -0
  300. package/src/domain/proxy/json-rpc.test.ts +72 -0
  301. package/src/domain/proxy/json-rpc.ts +53 -0
  302. package/src/domain/proxy/policy-engine.test.ts +259 -0
  303. package/src/domain/proxy/policy-engine.ts +137 -0
  304. package/src/domain/proxy/proxy-bridge.ts +125 -0
  305. package/src/domain/proxy/proxy-interceptor.test.ts +184 -0
  306. package/src/domain/proxy/proxy-interceptor.ts +120 -0
  307. package/src/domain/proxy/proxy-types.ts +35 -0
  308. package/src/domain/registry/compute-agent-score.test.ts +279 -0
  309. package/src/domain/registry/compute-agent-score.ts +162 -0
  310. package/src/domain/reporter/audit-report.test.ts +87 -0
  311. package/src/domain/reporter/audit-report.ts +116 -0
  312. package/src/domain/reporter/badge-generator.test.ts +54 -0
  313. package/src/domain/reporter/badge-generator.ts +40 -0
  314. package/src/domain/reporter/compliance-md.ts +45 -0
  315. package/src/domain/reporter/index.ts +7 -0
  316. package/src/domain/reporter/pdf-renderer.ts +282 -0
  317. package/src/domain/reporter/share.test.ts +92 -0
  318. package/src/domain/reporter/share.ts +80 -0
  319. package/src/domain/scanner/ast/swc-analyzer.test.ts +49 -0
  320. package/src/domain/scanner/ast/swc-analyzer.ts +124 -0
  321. package/src/domain/scanner/attestations.ts +97 -0
  322. package/src/domain/scanner/checks/ai-disclosure.test.ts +90 -0
  323. package/src/domain/scanner/checks/ai-disclosure.ts +54 -0
  324. package/src/domain/scanner/checks/ai-literacy.ts +163 -0
  325. package/src/domain/scanner/checks/behavioral-constraints.test.ts +167 -0
  326. package/src/domain/scanner/checks/behavioral-constraints.ts +86 -0
  327. package/src/domain/scanner/checks/compliance-metadata.ts +63 -0
  328. package/src/domain/scanner/checks/content-marking.ts +74 -0
  329. package/src/domain/scanner/checks/dep-deep-scan.test.ts +318 -0
  330. package/src/domain/scanner/checks/dep-deep-scan.ts +137 -0
  331. package/src/domain/scanner/checks/documentation.test.ts +88 -0
  332. package/src/domain/scanner/checks/documentation.ts +79 -0
  333. package/src/domain/scanner/checks/git-history.test.ts +120 -0
  334. package/src/domain/scanner/checks/git-history.ts +163 -0
  335. package/src/domain/scanner/checks/gpai-systemic-risk.test.ts +84 -0
  336. package/src/domain/scanner/checks/gpai-systemic-risk.ts +98 -0
  337. package/src/domain/scanner/checks/gpai-transparency.ts +94 -0
  338. package/src/domain/scanner/checks/index.ts +28 -0
  339. package/src/domain/scanner/checks/industry/index.ts +40 -0
  340. package/src/domain/scanner/checks/industry/industry.test.ts +287 -0
  341. package/src/domain/scanner/checks/interaction-logging.test.ts +113 -0
  342. package/src/domain/scanner/checks/interaction-logging.ts +142 -0
  343. package/src/domain/scanner/checks/nhi-scanner.test.ts +158 -0
  344. package/src/domain/scanner/checks/nhi-scanner.ts +78 -0
  345. package/src/domain/scanner/checks/passport-completeness.test.ts +127 -0
  346. package/src/domain/scanner/checks/passport-completeness.ts +82 -0
  347. package/src/domain/scanner/checks/passport-presence.test.ts +56 -0
  348. package/src/domain/scanner/checks/passport-presence.ts +78 -0
  349. package/src/domain/scanner/checks/pattern-check-factory.ts +70 -0
  350. package/src/domain/scanner/checks/permission-scanner.test.ts +279 -0
  351. package/src/domain/scanner/checks/permission-scanner.ts +90 -0
  352. package/src/domain/scanner/checks/presence-check-factory.test.ts +124 -0
  353. package/src/domain/scanner/checks/presence-check-factory.ts +275 -0
  354. package/src/domain/scanner/compliance-diff.test.ts +165 -0
  355. package/src/domain/scanner/compliance-diff.ts +138 -0
  356. package/src/domain/scanner/confidence.test.ts +235 -0
  357. package/src/domain/scanner/confidence.ts +156 -0
  358. package/src/domain/scanner/constants.ts +13 -0
  359. package/src/domain/scanner/create-scanner.ts +573 -0
  360. package/src/domain/scanner/cross-layer.test.ts +372 -0
  361. package/src/domain/scanner/cross-layer.ts +232 -0
  362. package/src/domain/scanner/data/ai-packages.ts +82 -0
  363. package/src/domain/scanner/debt-calculator.test.ts +89 -0
  364. package/src/domain/scanner/debt-calculator.ts +111 -0
  365. package/src/domain/scanner/drift.test.ts +191 -0
  366. package/src/domain/scanner/drift.ts +73 -0
  367. package/src/domain/scanner/evidence-store.test.ts +207 -0
  368. package/src/domain/scanner/evidence-store.ts +195 -0
  369. package/src/domain/scanner/evidence.test.ts +104 -0
  370. package/src/domain/scanner/evidence.ts +71 -0
  371. package/src/domain/scanner/external/bandit-runner.test.ts +45 -0
  372. package/src/domain/scanner/external/bandit-runner.ts +90 -0
  373. package/src/domain/scanner/external/checks.ts +321 -0
  374. package/src/domain/scanner/external/dedup.test.ts +79 -0
  375. package/src/domain/scanner/external/dedup.ts +94 -0
  376. package/src/domain/scanner/external/detect-secrets-runner.test.ts +58 -0
  377. package/src/domain/scanner/external/detect-secrets-runner.ts +81 -0
  378. package/src/domain/scanner/external/external-scanner.test.ts +221 -0
  379. package/src/domain/scanner/external/external-scanner.ts +36 -0
  380. package/src/domain/scanner/external/finding-mapper.test.ts +95 -0
  381. package/src/domain/scanner/external/finding-mapper.ts +138 -0
  382. package/src/domain/scanner/external/index.ts +15 -0
  383. package/src/domain/scanner/external/mappings.ts +93 -0
  384. package/src/domain/scanner/external/modelscan-runner.test.ts +35 -0
  385. package/src/domain/scanner/external/modelscan-runner.ts +101 -0
  386. package/src/domain/scanner/external/path-utils.ts +8 -0
  387. package/src/domain/scanner/external/runner-port.ts +45 -0
  388. package/src/domain/scanner/external/semgrep-runner.test.ts +52 -0
  389. package/src/domain/scanner/external/semgrep-runner.ts +94 -0
  390. package/src/domain/scanner/external/types.ts +32 -0
  391. package/src/domain/scanner/finding-attribution.test.ts +444 -0
  392. package/src/domain/scanner/finding-attribution.ts +195 -0
  393. package/src/domain/scanner/finding-explainer.test.ts +157 -0
  394. package/src/domain/scanner/finding-explainer.ts +73 -0
  395. package/src/domain/scanner/fix-diff-builder.test.ts +272 -0
  396. package/src/domain/scanner/fix-diff-builder.ts +477 -0
  397. package/src/domain/scanner/import-graph.test.ts +162 -0
  398. package/src/domain/scanner/import-graph.ts +198 -0
  399. package/src/domain/scanner/languages/adapter.test.ts +105 -0
  400. package/src/domain/scanner/languages/adapter.ts +239 -0
  401. package/src/domain/scanner/layers/index.ts +24 -0
  402. package/src/domain/scanner/layers/layer1-files.ts +54 -0
  403. package/src/domain/scanner/layers/layer2-docs.test.ts +1207 -0
  404. package/src/domain/scanner/layers/layer2-docs.ts +297 -0
  405. package/src/domain/scanner/layers/layer2-parsing.ts +217 -0
  406. package/src/domain/scanner/layers/layer3-config.test.ts +187 -0
  407. package/src/domain/scanner/layers/layer3-config.ts +279 -0
  408. package/src/domain/scanner/layers/layer3-parsers.ts +73 -0
  409. package/src/domain/scanner/layers/layer4-patterns.test.ts +397 -0
  410. package/src/domain/scanner/layers/layer4-patterns.ts +216 -0
  411. package/src/domain/scanner/layers/layer5-docs.test.ts +99 -0
  412. package/src/domain/scanner/layers/layer5-docs.ts +250 -0
  413. package/src/domain/scanner/layers/layer5-llm.test.ts +146 -0
  414. package/src/domain/scanner/layers/layer5-llm.ts +262 -0
  415. package/src/domain/scanner/layers/layer5-targeted.test.ts +93 -0
  416. package/src/domain/scanner/layers/layer5-targeted.ts +233 -0
  417. package/src/domain/scanner/layers/lockfile-parsers.test.ts +320 -0
  418. package/src/domain/scanner/layers/lockfile-parsers.ts +184 -0
  419. package/src/domain/scanner/regulation-version.test.ts +54 -0
  420. package/src/domain/scanner/regulation-version.ts +23 -0
  421. package/src/domain/scanner/role-filter.test.ts +116 -0
  422. package/src/domain/scanner/role-filter.ts +51 -0
  423. package/src/domain/scanner/rules/banned-packages-data.ts +553 -0
  424. package/src/domain/scanner/rules/banned-packages-sdk.ts +65 -0
  425. package/src/domain/scanner/rules/banned-packages.test.ts +249 -0
  426. package/src/domain/scanner/rules/banned-packages.ts +55 -0
  427. package/src/domain/scanner/rules/comment-filter.test.ts +115 -0
  428. package/src/domain/scanner/rules/comment-filter.ts +297 -0
  429. package/src/domain/scanner/rules/index.ts +9 -0
  430. package/src/domain/scanner/rules/nhi-patterns.test.ts +128 -0
  431. package/src/domain/scanner/rules/nhi-patterns.ts +60 -0
  432. package/src/domain/scanner/rules/pattern-rules.ts +1152 -0
  433. package/src/domain/scanner/sbom.test.ts +136 -0
  434. package/src/domain/scanner/sbom.ts +103 -0
  435. package/src/domain/scanner/scan-cache.test.ts +136 -0
  436. package/src/domain/scanner/scan-cache.ts +115 -0
  437. package/src/domain/scanner/scanner.test.ts +125 -0
  438. package/src/domain/scanner/score-calculator.test.ts +363 -0
  439. package/src/domain/scanner/score-calculator.ts +189 -0
  440. package/src/domain/scanner/security-score.test.ts +107 -0
  441. package/src/domain/scanner/security-score.ts +116 -0
  442. package/src/domain/scanner/source-filter.ts +24 -0
  443. package/src/domain/scanner/validators.ts +223 -0
  444. package/src/domain/shared/compliance-constants.ts +48 -0
  445. package/src/domain/shared/disclosure-patterns.ts +16 -0
  446. package/src/domain/shared/index.ts +6 -0
  447. package/src/domain/shared/parse-dependencies.ts +21 -0
  448. package/src/domain/supply-chain/dependency-analyzer.ts +138 -0
  449. package/src/domain/supply-chain/index.ts +3 -0
  450. package/src/domain/supply-chain/supply-chain.test.ts +211 -0
  451. package/src/domain/supply-chain/types.ts +32 -0
  452. package/src/domain/whatif/config-fixer.ts +187 -0
  453. package/src/domain/whatif/index.ts +6 -0
  454. package/src/domain/whatif/scenario-engine.ts +121 -0
  455. package/src/domain/whatif/simulate-actions.test.ts +161 -0
  456. package/src/domain/whatif/simulate-actions.ts +114 -0
  457. package/src/domain/whatif/whatif.test.ts +135 -0
  458. package/src/e2e/gaps-e2e.test.ts +259 -0
  459. package/src/e2e/smoke.test.ts +101 -0
  460. package/src/hooks/hooks-export.test.ts +81 -0
  461. package/src/hooks/installer.ts +113 -0
  462. package/src/http/cors.test.ts +38 -0
  463. package/src/http/create-router.ts +259 -0
  464. package/src/http/routes/agent.route.ts +380 -0
  465. package/src/http/routes/audit.route.ts +66 -0
  466. package/src/http/routes/badge.route.ts +23 -0
  467. package/src/http/routes/cert.route.ts +66 -0
  468. package/src/http/routes/chat.route.ts +228 -0
  469. package/src/http/routes/cost.route.ts +33 -0
  470. package/src/http/routes/debt.route.ts +29 -0
  471. package/src/http/routes/disclaimer.route.ts +64 -0
  472. package/src/http/routes/eval.route.ts +161 -0
  473. package/src/http/routes/events.route.test.ts +108 -0
  474. package/src/http/routes/events.route.ts +71 -0
  475. package/src/http/routes/external-scan.route.ts +24 -0
  476. package/src/http/routes/file.route.ts +54 -0
  477. package/src/http/routes/fix.route.ts +219 -0
  478. package/src/http/routes/frameworks.route.test.ts +66 -0
  479. package/src/http/routes/frameworks.route.ts +36 -0
  480. package/src/http/routes/git.route.ts +27 -0
  481. package/src/http/routes/guided-onboarding.route.ts +65 -0
  482. package/src/http/routes/import.route.ts +64 -0
  483. package/src/http/routes/jurisdiction.route.ts +22 -0
  484. package/src/http/routes/obligations.route.test.ts +122 -0
  485. package/src/http/routes/obligations.route.ts +110 -0
  486. package/src/http/routes/onboarding.route.ts +53 -0
  487. package/src/http/routes/provider.route.ts +42 -0
  488. package/src/http/routes/proxy.route.ts +40 -0
  489. package/src/http/routes/redteam.route.ts +84 -0
  490. package/src/http/routes/report.route.ts +29 -0
  491. package/src/http/routes/scan.route.ts +104 -0
  492. package/src/http/routes/share.route.ts +44 -0
  493. package/src/http/routes/shell.route.ts +27 -0
  494. package/src/http/routes/status.route.ts +66 -0
  495. package/src/http/routes/supply-chain.route.ts +121 -0
  496. package/src/http/routes/sync.route.ts +328 -0
  497. package/src/http/routes/tools.route.ts +29 -0
  498. package/src/http/routes/whatif.route.ts +96 -0
  499. package/src/http/utils/validation.ts +31 -0
  500. package/src/index.ts +1 -0
  501. package/src/infra/bundle-fetcher.ts +77 -0
  502. package/src/infra/cache-storage.ts +34 -0
  503. package/src/infra/event-bus.ts +31 -0
  504. package/src/infra/file-collector.ts +61 -0
  505. package/src/infra/file-ops-adapter.ts +95 -0
  506. package/src/infra/file-watcher.test.ts +90 -0
  507. package/src/infra/file-watcher.ts +106 -0
  508. package/src/infra/git-adapter.ts +93 -0
  509. package/src/infra/git-history-adapter.ts +41 -0
  510. package/src/infra/headless-browser.ts +178 -0
  511. package/src/infra/llm-adapter.test.ts +83 -0
  512. package/src/infra/llm-adapter.ts +86 -0
  513. package/src/infra/logger.ts +27 -0
  514. package/src/infra/project-config.test.ts +74 -0
  515. package/src/infra/project-config.ts +35 -0
  516. package/src/infra/rate-limiter.test.ts +36 -0
  517. package/src/infra/rate-limiter.ts +34 -0
  518. package/src/infra/retry.ts +46 -0
  519. package/src/infra/saas-client.ts +123 -0
  520. package/src/infra/search-adapter.ts +113 -0
  521. package/src/infra/shell-adapter.ts +68 -0
  522. package/src/infra/tool-manager.test.ts +99 -0
  523. package/src/infra/tool-manager.ts +197 -0
  524. package/src/llm/agents/agent-modes.test.ts +44 -0
  525. package/src/llm/agents/modes.ts +68 -0
  526. package/src/llm/routing/cost-routing.test.ts +37 -0
  527. package/src/llm/routing/cost-tracker.ts +74 -0
  528. package/src/llm/routing/model-routing.test.ts +79 -0
  529. package/src/llm/routing/model-routing.ts +38 -0
  530. package/src/llm/routing/pricing.ts +19 -0
  531. package/src/llm/sse-protocol.ts +77 -0
  532. package/src/llm/tool-definitions.ts +83 -0
  533. package/src/llm/tool-executors.ts +80 -0
  534. package/src/llm/tools/types.ts +13 -0
  535. package/src/mcp/create-mcp-stack.ts +82 -0
  536. package/src/mcp/handlers.ts +245 -0
  537. package/src/mcp/index.ts +28 -0
  538. package/src/mcp/mcp-server.test.ts +80 -0
  539. package/src/mcp/server.ts +79 -0
  540. package/src/mcp/tools.ts +48 -0
  541. package/src/onboarding/auto-detect.ts +164 -0
  542. package/src/onboarding/onboarding.test.ts +89 -0
  543. package/src/onboarding/profile.ts +169 -0
  544. package/src/onboarding/questions.ts +112 -0
  545. package/src/onboarding/wizard.ts +66 -0
  546. package/src/output/github-issue.ts +32 -0
  547. package/src/output/json-output.ts +67 -0
  548. package/src/ports/browser.port.ts +23 -0
  549. package/src/ports/events.port.ts +28 -0
  550. package/src/ports/llm.port.ts +23 -0
  551. package/src/ports/logger.port.ts +6 -0
  552. package/src/ports/process.port.ts +6 -0
  553. package/src/ports/scanner.port.ts +15 -0
  554. package/src/server.ts +134 -0
  555. package/src/services/badge-service.ts +67 -0
  556. package/src/services/chat-service.test.ts +162 -0
  557. package/src/services/chat-service.ts +152 -0
  558. package/src/services/cost-service.ts +52 -0
  559. package/src/services/debt-service.ts +65 -0
  560. package/src/services/eval-integration.test.ts +132 -0
  561. package/src/services/eval-service.test.ts +373 -0
  562. package/src/services/eval-service.ts +463 -0
  563. package/src/services/external-scan-service.ts +60 -0
  564. package/src/services/file-service.ts +37 -0
  565. package/src/services/fix-service.test.ts +470 -0
  566. package/src/services/fix-service.ts +648 -0
  567. package/src/services/framework-service.test.ts +159 -0
  568. package/src/services/framework-service.ts +67 -0
  569. package/src/services/onboarding-service.ts +165 -0
  570. package/src/services/passport-audit.ts +244 -0
  571. package/src/services/passport-documents.ts +258 -0
  572. package/src/services/passport-service-utils.ts +72 -0
  573. package/src/services/passport-service.test.ts +251 -0
  574. package/src/services/passport-service.ts +339 -0
  575. package/src/services/proxy-service.ts +81 -0
  576. package/src/services/report-service.ts +72 -0
  577. package/src/services/scan-service.test.ts +470 -0
  578. package/src/services/scan-service.ts +335 -0
  579. package/src/services/share-service.ts +108 -0
  580. package/src/services/shared/backup.ts +23 -0
  581. package/src/services/status-service.ts +38 -0
  582. package/src/services/undo-service.test.ts +190 -0
  583. package/src/services/undo-service.ts +144 -0
  584. package/src/test-helpers/factories.ts +116 -0
  585. package/src/types/common.schemas.ts +147 -0
  586. package/src/types/common.types.ts +292 -0
  587. package/src/types/contract.test.ts +217 -0
  588. package/src/types/errors.ts +52 -0
  589. package/src/types/framework.types.ts +87 -0
  590. package/src/types/passport-schemas.ts +241 -0
  591. package/src/types/passport.types.ts +296 -0
  592. package/src/version.ts +1 -0
  593. package/tsconfig.json +20 -0
  594. package/vitest.config.ts +9 -0
@@ -0,0 +1,127 @@
1
+ # Template 3: Fundamental Rights Impact Assessment (FRIA)
2
+
3
+ **Obligation:** eu-ai-act-OBL-013
4
+ **Article:** Article 27
5
+ **For:** Deployers (public bodies + credit/insurance deployers)
6
+ **Format:** DOCX / PDF
7
+
8
+ ## Document Structure:
9
+
10
+ ### 1. Assessment Header
11
+ <!-- GUIDANCE: Complete all header fields to establish traceability. The Assessment ID
12
+ should follow your organization's document numbering scheme. DPO consultation is
13
+ mandatory per GDPR Art. 35 alignment. Example: "FRIA-2026-001" for the first
14
+ assessment of 2026. -->
15
+
16
+ | Field | Value |
17
+ |-------|-------|
18
+ | Document Title | Fundamental Rights Impact Assessment — [AI System Name] |
19
+ | Assessment ID | FRIA-[YYYY]-[NNN] |
20
+ | Date | [Date] |
21
+ | Assessor | [Name, Title] |
22
+ | DPO Consulted | [Name, Date] |
23
+
24
+ ### 2. AI System Description
25
+ <!-- GUIDANCE: Describe the system comprehensively per Art. 27(3)(a). Include the
26
+ specific use case, not just the product name. "Categories of persons affected" must
27
+ list all groups — direct users, subjects of decisions, and bystanders.
28
+ Example: A CV screening tool affects applicants (decisions), HR staff (users),
29
+ and rejected candidates (indirect impact). -->
30
+
31
+ - System name: [Name]
32
+ - Provider: [Name]
33
+ - Version: [Number]
34
+ - Intended purpose: [Description]
35
+ - Deployment context: [Where and how the system is used]
36
+ - Categories of persons affected: [List]
37
+ - Geographic scope: [Member States where deployed]
38
+
39
+ ### 3. Deployer Information
40
+ <!-- GUIDANCE: Art. 27 applies only to deployers that are public bodies, bodies
41
+ governed by public law, or private deployers in credit/insurance. Identify which
42
+ trigger applies. If none apply, document why FRIA is conducted voluntarily.
43
+ Example: A municipal government using AI for benefit eligibility is a "public body." -->
44
+
45
+ - Organisation: [Name]
46
+ - Type: [ ] Public body [ ] Body governed by public law [ ] Private deployer (credit/insurance)
47
+ - Article 27 trigger: [Which condition applies]
48
+
49
+ ### 4. Fundamental Rights Risk Assessment
50
+ <!-- GUIDANCE: For each fundamental right (Charter Arts. 1,7,8,11,21,24,31,41,47),
51
+ assess risk level (High/Medium/Low/None) per Art. 27(3)(c). Describe the specific
52
+ mechanism by which the AI system could impact this right, not just generic risks.
53
+ Example: A credit scoring system may affect non-discrimination (Art. 21) through
54
+ biased training data that underrepresents minority applicants. -->
55
+
56
+ | Fundamental Right | Risk Level | Description of Risk | Affected Group | Mitigation Measures |
57
+ |-------------------|-----------|---------------------|----------------|---------------------|
58
+ | Non-discrimination (Charter Art. 21) | [H/M/L/N] | [e.g., AI may produce biased outcomes against certain ethnic groups in credit decisions] | [e.g., Loan applicants from minority backgrounds] | [e.g., Regular bias audits, human review of rejections, fairness metrics monitoring] |
59
+ | Privacy and data protection (Charter Art. 7-8) | [H/M/L/N] | [Description] | [Group] | [Measures] |
60
+ | Freedom of expression (Charter Art. 11) | [H/M/L/N] | [Description] | [Group] | [Measures] |
61
+ | Human dignity (Charter Art. 1) | [H/M/L/N] | [Description] | [Group] | [Measures] |
62
+ | Right to an effective remedy (Charter Art. 47) | [H/M/L/N] | [Description] | [Group] | [Measures] |
63
+ | Rights of the child (Charter Art. 24) | [H/M/L/N] | [Description] | [Group] | [Measures] |
64
+ | Workers' rights (Charter Art. 31) | [H/M/L/N] | [Description] | [Group] | [Measures] |
65
+ | Right to good administration (Charter Art. 41) | [H/M/L/N] | [Description] | [Group] | [Measures] |
66
+
67
+ ### 5. Mitigation Measures and Human Oversight
68
+ <!-- GUIDANCE: Art. 14 requires human oversight proportionate to the risk. Specify
69
+ a named individual (not just a role), describe the technical override mechanism,
70
+ and define the escalation timeline. Example: "System pauses after 3 consecutive
71
+ low-confidence scores; oversight officer reviews within 2 hours." -->
72
+ - Assigned oversight person: [Name, Title, Training completed]
73
+ - Override mechanism: [Description of how human can intervene/stop the system]
74
+ - Escalation process: [When and how decisions are escalated to humans]
75
+ - Review frequency: [How often human reviews AI outputs]
76
+
77
+ ### 6. Impact Analysis and Remediation
78
+ <!-- GUIDANCE: Art. 27(3)(e) requires concrete measures, not aspirational statements.
79
+ Include specific suspension criteria (e.g., "if bias exceeds 5% differential across
80
+ protected groups") and remediation timelines. Example: "Affected persons notified
81
+ within 48 hours; alternative manual assessment offered within 5 business days." -->
82
+ - Incident response plan: [Summary]
83
+ - Communication to affected persons: [Process]
84
+ - System suspension criteria: [Under what conditions will the system be stopped]
85
+ - Remediation process: [How affected persons will be made whole]
86
+
87
+ ### 7. Governance and Complaints
88
+ <!-- GUIDANCE: Art. 27(3)(f) requires a functioning complaint mechanism. Provide
89
+ actual contact details, expected response times, and the path to external remedies
90
+ (national MSA, judicial review). Example: "Complaints submitted via
91
+ complaints@org.eu, acknowledged within 3 business days, resolved within 30 days." -->
92
+ - Internal complaint mechanism: [Description, contact details]
93
+ - External complaint options: [Market surveillance authority, judicial remedies]
94
+ - Data protection officer involvement: [DPO name, consultation record]
95
+
96
+ ### 8. GDPR Alignment
97
+ <!-- GUIDANCE: If a DPIA was conducted under GDPR Art. 35, reference it by document
98
+ ID. The FRIA should complement, not duplicate, the DPIA. Identify the Art. 6(1)
99
+ legal basis explicitly. Example: "DPIA-2025-012; legal basis: Art. 6(1)(e)
100
+ (public interest task) for public sector deployers." -->
101
+ - Has a DPIA been conducted under GDPR Art. 35? [Yes/No — reference]
102
+ - Legal basis for personal data processing: [Art. 6(1) basis]
103
+ - Data protection measures: [Summary]
104
+
105
+ ### 9. Conclusion and Decision
106
+ <!-- GUIDANCE: Art. 27(4) requires notification to the MSA if risk is deemed
107
+ unacceptable. Use clear decision language — avoid "generally acceptable" or
108
+ "mostly compliant." If proceeding with conditions, list each condition with
109
+ a deadline and responsible person. Example: "Proceed with condition: bias audit
110
+ completed by 2026-06-01, assigned to Data Ethics Lead." -->
111
+ - Overall risk assessment: [Acceptable / Acceptable with mitigations / Unacceptable — do not deploy]
112
+ - Decision: [Proceed with deployment / Proceed with conditions / Do not proceed]
113
+ - Conditions for deployment (if applicable): [List]
114
+ - Next review date: [Date]
115
+
116
+ ### 10. Sign-off
117
+ <!-- GUIDANCE: All three sign-offs are required: the person who conducted the
118
+ assessment, the DPO who was consulted (Art. 27(2)), and the organizational
119
+ decision-maker. If notifying the MSA, record the submission date and authority.
120
+ Example: MSA notification submitted to ACM (Netherlands) on 2026-03-15. -->
121
+ - Assessor: _________________ Date: _________
122
+ - DPO: _________________ Date: _________
123
+ - Decision-maker: _________________ Date: _________
124
+ - Notification to market surveillance authority: [Date submitted, authority name]
125
+
126
+ ## Legal Formulation:
127
+ "This Fundamental Rights Impact Assessment is conducted pursuant to Article 27 of Regulation (EU) 2024/1689 (EU AI Act). The assessment evaluates the potential impact on fundamental rights of the deployment of the high-risk AI system identified herein, in accordance with the requirements of Article 27(3)(a)-(f)."
@@ -0,0 +1,150 @@
1
+ # GPAI Systemic Risk Assessment
2
+
3
+ > **Regulation**: EU AI Act (Regulation (EU) 2024/1689), Article 55 / Annex XIII
4
+ > **Obligation**: OBL-023 — GPAI with Systemic Risk
5
+ > **For**: Providers of GPAI Models with Systemic Risk
6
+ > **Deadline**: August 2, 2025 (12 months after entry into force)
7
+ > **Document ID**: GSR-[YYYY]-[NNN]
8
+
9
+ <!-- GUIDANCE: Art. 51(2) defines systemic risk: GPAI models with high impact capabilities.
10
+ Art. 55 requires additional obligations including model evaluations, adversarial testing,
11
+ tracking and reporting serious incidents, and ensuring adequate cybersecurity. Annex XIII
12
+ classifies a model as systemic risk if cumulative compute >10^25 FLOPs. -->
13
+
14
+ ---
15
+
16
+ ## 1. Document Control
17
+
18
+ | Field | Value |
19
+ |-------|-------|
20
+ | Model Name | [AI System Name] |
21
+ | Provider | [Company Name] |
22
+ | Version | [X.Y] |
23
+ | Document ID | GSR-[YYYY]-[NNN] |
24
+ | Created | [Date] |
25
+ | Last Review | [Date] |
26
+
27
+ ---
28
+
29
+ ## 2. Systemic Risk Classification
30
+
31
+ ### 2.1 Classification Basis
32
+
33
+ | Criterion | Value | Threshold | Exceeds? |
34
+ |-----------|-------|-----------|----------|
35
+ | Cumulative compute (FLOPs) | | 10^25 | Yes/No |
36
+ | Commission designation | | N/A | Yes/No |
37
+
38
+ ### 2.2 High Impact Capabilities (Art. 51(1)(a))
39
+
40
+ | Capability | Description | Assessment |
41
+ |-----------|-------------|-----------|
42
+ | | | |
43
+
44
+ ---
45
+
46
+ ## 3. Model Evaluation (Art. 55(1)(a))
47
+
48
+ <!-- GUIDANCE: Art. 55(1)(a) requires performing model evaluations, including
49
+ conducting and documenting adversarial testing, to identify and mitigate
50
+ systemic risks, including with the use of model evaluations. -->
51
+
52
+ ### 3.1 State-of-the-Art Evaluations
53
+
54
+ | Evaluation | Framework | Result | Date | Evaluator |
55
+ |-----------|-----------|--------|------|-----------|
56
+ | | | | | |
57
+
58
+ ### 3.2 Adversarial Testing
59
+
60
+ | Test | Methodology | Attack Surface | Result | Mitigation |
61
+ |------|-------------|---------------|--------|------------|
62
+ | Prompt injection | | | | |
63
+ | Jailbreak attempts | | | | |
64
+ | Information extraction | | | | |
65
+ | Harmful content generation | | | | |
66
+ | Code generation (malware) | | | | |
67
+
68
+ ---
69
+
70
+ ## 4. Systemic Risk Assessment (Art. 55(1)(a))
71
+
72
+ ### 4.1 Identified Systemic Risks
73
+
74
+ | # | Risk | Description | Likelihood | Impact | Mitigation |
75
+ |---|------|-------------|------------|--------|------------|
76
+ | 1 | Disinformation at scale | | | | |
77
+ | 2 | CBRN knowledge access | | | | |
78
+ | 3 | Cyber attack enablement | | | | |
79
+ | 4 | Critical infrastructure impact | | | | |
80
+ | 5 | Discrimination at scale | | | | |
81
+
82
+ ### 4.2 Risk Mitigation Measures
83
+
84
+ | Risk | Measure | Status | Effectiveness |
85
+ |------|---------|--------|--------------|
86
+ | | | Planned/Implemented/Verified | |
87
+
88
+ ---
89
+
90
+ ## 5. Serious Incident Tracking (Art. 55(1)(c))
91
+
92
+ <!-- GUIDANCE: Art. 55(1)(c) requires tracking, documenting, and reporting
93
+ serious incidents and possible corrective measures to the AI Office
94
+ and relevant national competent authorities without undue delay. -->
95
+
96
+ ### 5.1 Incident Register
97
+
98
+ | # | Date | Description | Severity | Reported To | Status |
99
+ |---|------|-------------|----------|-----------|--------|
100
+ | | | | | AI Office / NCA | Open/Resolved |
101
+
102
+ ### 5.2 Reporting Procedures
103
+
104
+ | Aspect | Description |
105
+ |--------|-------------|
106
+ | Incident detection mechanism | |
107
+ | Reporting timeline | Without undue delay |
108
+ | AI Office contact | |
109
+ | National authority contact | |
110
+ | Internal escalation path | |
111
+
112
+ ---
113
+
114
+ ## 6. Cybersecurity (Art. 55(1)(d))
115
+
116
+ <!-- GUIDANCE: Art. 55(1)(d) requires ensuring an adequate level of cybersecurity
117
+ protection for the GPAI model with systemic risk and the physical infrastructure
118
+ of the model. -->
119
+
120
+ | Measure | Description | Status |
121
+ |---------|-------------|--------|
122
+ | Model access controls | | |
123
+ | Weight protection | | |
124
+ | API security | | |
125
+ | Infrastructure security | | |
126
+ | Supply chain security | | |
127
+ | Penetration testing | | |
128
+ | Vulnerability management | | |
129
+
130
+ ---
131
+
132
+ ## 7. Codes of Practice (Art. 56)
133
+
134
+ <!-- GUIDANCE: Art. 56 encourages providers to participate in codes of practice
135
+ to demonstrate compliance with Arts. 53 and 55 obligations. -->
136
+
137
+ | Code of Practice | Status | Commitment Date |
138
+ |-----------------|--------|----------------|
139
+ | EU AI Pact | Joined / Not joined | |
140
+ | Industry code | | |
141
+
142
+ ---
143
+
144
+ ## Sign-off
145
+
146
+ | Role | Name | Signature | Date |
147
+ |------|------|-----------|------|
148
+ | Model Lead | | | |
149
+ | Security Officer | | | |
150
+ | Compliance Officer | | | |
@@ -0,0 +1,166 @@
1
+ # GPAI Model Transparency Documentation
2
+
3
+ > **Regulation**: EU AI Act (Regulation (EU) 2024/1689), Articles 51-53 / Annex XI
4
+ > **Obligation**: OBL-022 — GPAI Transparency Obligations
5
+ > **For**: Providers of General-Purpose AI Models
6
+ > **Deadline**: August 2, 2025 (12 months after entry into force)
7
+ > **Document ID**: GPAI-[YYYY]-[NNN]
8
+
9
+ <!-- GUIDANCE: Art. 53(1) requires GPAI providers to draw up and keep up to date
10
+ technical documentation of the model, including training and testing processes
11
+ and results of evaluation, following Annex XI. This must be provided to the
12
+ AI Office and downstream providers upon request. -->
13
+
14
+ ---
15
+
16
+ ## 1. Document Control
17
+
18
+ | Field | Value |
19
+ |-------|-------|
20
+ | Model Name | [AI System Name] |
21
+ | Provider | [Company Name] |
22
+ | Version | [X.Y] |
23
+ | Document ID | GPAI-[YYYY]-[NNN] |
24
+ | Created | [Date] |
25
+ | Last Review | [Date] |
26
+
27
+ ---
28
+
29
+ ## 2. Model Identification (Annex XI §1)
30
+
31
+ <!-- GUIDANCE: Annex XI(1)(a)-(c) requires identification of the model,
32
+ including resources used for development and known limitations. -->
33
+
34
+ | Field | Value |
35
+ |-------|-------|
36
+ | Model name and version | |
37
+ | Date of release | |
38
+ | Modalities (text/image/code/multi) | |
39
+ | Architecture type | |
40
+ | Number of parameters | |
41
+ | Context window | |
42
+ | Input/output formats | |
43
+ | License | |
44
+
45
+ ---
46
+
47
+ ## 3. Training Description (Annex XI §2)
48
+
49
+ <!-- GUIDANCE: Annex XI(1)(d) requires description of relevant information
50
+ about the data used for training, testing, and validation. -->
51
+
52
+ ### 3.1 Training Data
53
+
54
+ | Aspect | Description |
55
+ |--------|-------------|
56
+ | Data sources | |
57
+ | Data volume (tokens/samples) | |
58
+ | Data cutoff date | |
59
+ | Languages covered | |
60
+ | Web crawling methodology (if used) | |
61
+ | Data filtering / cleaning process | |
62
+ | Copyrighted material policy | |
63
+
64
+ ### 3.2 Training Process
65
+
66
+ | Aspect | Description |
67
+ |--------|-------------|
68
+ | Training methodology | |
69
+ | Compute used (FLOPs) | |
70
+ | Hardware | |
71
+ | Training duration | |
72
+ | Fine-tuning approach | |
73
+ | RLHF / alignment method | |
74
+
75
+ ---
76
+
77
+ ## 4. Evaluation and Testing (Annex XI §3)
78
+
79
+ <!-- GUIDANCE: Annex XI(1)(e) requires quantitative evaluation results,
80
+ including benchmark performance across capabilities and limitations. -->
81
+
82
+ ### 4.1 Benchmark Results
83
+
84
+ | Benchmark | Score | Date | Notes |
85
+ |-----------|-------|------|-------|
86
+ | | | | |
87
+
88
+ ### 4.2 Safety Evaluations
89
+
90
+ | Test | Methodology | Result | Threshold |
91
+ |------|-------------|--------|-----------|
92
+ | Toxicity | | | |
93
+ | Bias / Fairness | | | |
94
+ | Hallucination rate | | | |
95
+ | Instruction following | | | |
96
+ | Refusal behavior | | | |
97
+
98
+ ---
99
+
100
+ ## 5. Known Limitations (Annex XI §1(c))
101
+
102
+ | # | Limitation | Circumstances | Impact |
103
+ |---|-----------|---------------|--------|
104
+ | 1 | | | |
105
+
106
+ ---
107
+
108
+ ## 6. Capabilities (Annex XI §1(b))
109
+
110
+ | Capability | Description | Evidence |
111
+ |-----------|-------------|---------|
112
+ | | | |
113
+
114
+ ---
115
+
116
+ ## 7. Copyright Compliance (Art. 53(1)(c))
117
+
118
+ <!-- GUIDANCE: Art. 53(1)(c) requires GPAI providers to put in place a policy to
119
+ comply with Union copyright law, in particular to identify and comply with
120
+ reservations of rights expressed pursuant to Art. 4(3) of Directive (EU) 2019/790. -->
121
+
122
+ | Aspect | Description |
123
+ |--------|-------------|
124
+ | Copyright compliance policy | |
125
+ | Opt-out mechanism (Art. 4(3) Dir. 2019/790) | |
126
+ | Training data rights verification | |
127
+ | Rights reservation identification method | |
128
+
129
+ ---
130
+
131
+ ## 8. Summary for Downstream Providers (Art. 53(1)(b))
132
+
133
+ <!-- GUIDANCE: Art. 53(1)(b) requires making available to downstream providers
134
+ sufficiently detailed information about the model's capabilities and limitations
135
+ to enable them to comply with their obligations under the AI Act. -->
136
+
137
+ | Field | Value |
138
+ |-------|-------|
139
+ | Model capabilities summary | |
140
+ | Known limitations for downstream use | |
141
+ | Intended downstream use cases | |
142
+ | Not suitable for | |
143
+ | Integration guidance | |
144
+ | Reporting mechanism for issues | |
145
+
146
+ ---
147
+
148
+ ## 9. Energy Consumption (Art. 53(1)(a))
149
+
150
+ <!-- GUIDANCE: Art. 53(1)(a) requires documenting energy consumption for
151
+ training and inference. -->
152
+
153
+ | Phase | Energy (kWh) | Carbon Footprint (tCO2e) | Methodology |
154
+ |-------|-------------|-------------------------|-------------|
155
+ | Training | | | |
156
+ | Fine-tuning | | | |
157
+ | Inference (per 1M tokens) | | | |
158
+
159
+ ---
160
+
161
+ ## Sign-off
162
+
163
+ | Role | Name | Signature | Date |
164
+ |------|------|-----------|------|
165
+ | Model Lead | | | |
166
+ | Compliance Officer | | | |
@@ -0,0 +1,188 @@
1
+ # Serious Incident Report
2
+
3
+ > **Regulation**: EU AI Act (Regulation (EU) 2024/1689), Article 73
4
+ > **Obligation**: OBL-021 — Serious Incident Reporting
5
+ > **For**: Providers of High-Risk AI Systems
6
+ > **Deadline**: August 2, 2026
7
+ > **Document ID**: INC-[YYYY]-[NNN]
8
+
9
+ <!-- GUIDANCE: Art. 73(1) requires notification within:
10
+ - 2 days for death or serious damage to health
11
+ - 15 days for all other serious incidents
12
+ This is from when the provider BECOMES AWARE of the incident. -->
13
+
14
+ ---
15
+
16
+ ## 1. Report Header
17
+
18
+ | Field | Value |
19
+ |-------|-------|
20
+ | Report Reference | INC-[YYYY]-[NNN] |
21
+ | Report Type | Initial / Follow-up / Final |
22
+ | Submission Date | [Date] |
23
+ | Submitted To | [Market Surveillance Authority, Member State] |
24
+ | Incident Date | |
25
+ | Awareness Date | |
26
+ | Notification Deadline | |
27
+
28
+ ---
29
+
30
+ ## 2. Provider Information
31
+
32
+ | Field | Value |
33
+ |-------|-------|
34
+ | Provider | [Company Name] |
35
+ | Address | |
36
+ | Authorised Representative (if outside EU) | |
37
+ | Contact Person | |
38
+ | Contact Email | |
39
+ | Contact Phone | |
40
+
41
+ ---
42
+
43
+ ## 3. AI System Identification
44
+
45
+ | Field | Value |
46
+ |-------|-------|
47
+ | System Name | [AI System Name] |
48
+ | Version at time of incident | [X.Y] |
49
+ | EU Database Registration | |
50
+ | CE Marking | Yes / No |
51
+ | Risk Class | [Risk Class] |
52
+ | Unique Identification | |
53
+
54
+ ---
55
+
56
+ ## 4. Incident Description
57
+
58
+ <!-- GUIDANCE: Art. 73(4)(a) requires factual description. Be precise about timing,
59
+ location, and circumstances. Select ALL applicable incident types. -->
60
+
61
+ | Field | Value |
62
+ |-------|-------|
63
+ | Date and Time | |
64
+ | Location (Member State) | |
65
+ | Specific Location | |
66
+
67
+ ### 4.1 Type of Serious Incident
68
+
69
+ - [ ] Death of a person
70
+ - [ ] Serious damage to health of a person
71
+ - [ ] Serious and irreversible disruption of management/operation of critical infrastructure
72
+ - [ ] Serious breach of obligations under Union law intended to protect fundamental rights
73
+ - [ ] Serious damage to property or the environment
74
+
75
+ ### 4.2 Factual Description
76
+
77
+ [Detailed, objective, evidence-based description of what happened]
78
+
79
+ ---
80
+
81
+ ## 5. Affected Persons
82
+
83
+ | # | Category | Number Affected | Nature of Harm | Demographics (if relevant) |
84
+ |---|----------|-----------------|---------------|---------------------------|
85
+ | 1 | | | | |
86
+
87
+ ---
88
+
89
+ ## 6. Timeline of Events
90
+
91
+ <!-- GUIDANCE: Document the complete timeline from first indication to current status.
92
+ This is critical for demonstrating timely response under Art. 73. -->
93
+
94
+ | Date/Time | Event | Source | Recorded By |
95
+ |-----------|-------|--------|-------------|
96
+ | | First indication / anomaly detected | | |
97
+ | | Incident confirmed | | |
98
+ | | Provider became aware | | |
99
+ | | Immediate containment actions | | |
100
+ | | Initial report submitted | | |
101
+ | | Root cause analysis started | | |
102
+ | | Corrective measures implemented | | |
103
+
104
+ ---
105
+
106
+ ## 7. Root Cause Analysis
107
+
108
+ <!-- GUIDANCE: Establish causal chain. If root cause is not yet determined,
109
+ state this explicitly. Indicate whether the issue is systemic or isolated. -->
110
+
111
+ | Aspect | Description |
112
+ |--------|-------------|
113
+ | Causal link to AI system | Direct / Contributing / Coincidental / Unknown |
114
+ | Root cause (if determined) | |
115
+ | Contributing factors | |
116
+ | Systemic or isolated? | |
117
+ | Technical analysis | |
118
+
119
+ ---
120
+
121
+ ## 8. Immediate Actions Taken
122
+
123
+ <!-- GUIDANCE: Art. 73(4)(d) requires description of corrective actions already taken. -->
124
+
125
+ | Action | Date | Status | Responsible |
126
+ |--------|------|--------|-------------|
127
+ | System suspended / restricted | | Done/Pending | |
128
+ | Affected persons notified | | Done/Pending | |
129
+ | Manual fallback activated | | Done/Pending | |
130
+ | Data preserved for analysis | | Done/Pending | |
131
+
132
+ **System Status**: Operational / Suspended / Withdrawn / Restricted
133
+
134
+ ---
135
+
136
+ ## 9. Corrective Measures Planned
137
+
138
+ | # | Measure | Timeline | Responsible | Verification Method | Substantial Modification? |
139
+ |---|---------|----------|-------------|--------------------|-----------------------------|
140
+ | 1 | | | | | Yes/No |
141
+
142
+ ---
143
+
144
+ ## 10. Follow-up Reports
145
+
146
+ <!-- GUIDANCE: Follow-up reports are required within 15 days of initial submission.
147
+ Final report must include confirmed root cause and completed corrective actions. -->
148
+
149
+ | Report # | Type | Date Submitted | Key Updates |
150
+ |----------|------|---------------|-------------|
151
+ | 1 | Initial | | |
152
+ | 2 | Follow-up | | |
153
+ | 3 | Final | | |
154
+
155
+ ---
156
+
157
+ ## 11. Automated Incident Data
158
+
159
+ <!-- GUIDANCE: If using Complior SDK or similar monitoring, reference automated
160
+ logs that captured the incident. Include log correlation IDs. -->
161
+
162
+ | Data Source | Log Reference | Time Range | Available? |
163
+ |-----------|--------------|-----------|-----------|
164
+ | Application logs | | | Yes/No |
165
+ | AI interaction logs | | | Yes/No |
166
+ | Monitoring alerts | | | Yes/No |
167
+ | User feedback | | | Yes/No |
168
+
169
+ ---
170
+
171
+ ## 12. Lessons Learned
172
+
173
+ | # | Finding | Recommendation | Priority |
174
+ |---|---------|---------------|----------|
175
+ | 1 | | | |
176
+
177
+ ---
178
+
179
+ ## Sign-off
180
+
181
+ | Role | Name | Signature | Date |
182
+ |------|------|-----------|------|
183
+ | Report Author | | | |
184
+ | Technical Lead | | | |
185
+ | Compliance Officer | | | |
186
+ | Authorised Signatory | | | |
187
+
188
+ *Submission confirmation: [Method, Date, Authority reference number]*