From cc919eb60826d00cc1647a93e209d59bfdf8a303 Mon Sep 17 00:00:00 2001
From: Benjamin Admin
Date: Mon, 11 May 2026 08:00:36 +0200
Subject: [PATCH] feat: KI-Agent toggle in all 3 check tabs
- Impressum-Check: Toggle activates 75 Impressum MCs via agent
- Banner-Check: Toggle runs additional cookie doc-check (381 MCs)
after the Playwright banner test completes
- Both use the same use_agent flag through doc-check endpoint
Green pill button consistent across all tabs:
'KI-Agent aus' / 'KI-Agent aktiv (X MCs)'
Co-Authored-By: Claude Opus 4.6 (1M context)
---
.../sdk/agent/_components/BannerCheckTab.tsx | 50 +++++++++++++++++++
.../agent/_components/ImpressumCheckTab.tsx | 13 +++++
2 files changed, 63 insertions(+)
diff --git a/admin-compliance/app/sdk/agent/_components/BannerCheckTab.tsx b/admin-compliance/app/sdk/agent/_components/BannerCheckTab.tsx
index a71e949..3a9cdc3 100644
--- a/admin-compliance/app/sdk/agent/_components/BannerCheckTab.tsx
+++ b/admin-compliance/app/sdk/agent/_components/BannerCheckTab.tsx
@@ -55,6 +55,8 @@ export function BannerCheckTab() {
try { const s = localStorage.getItem('banner-check-result'); return s ? JSON.parse(s) : null } catch { return null }
})
const [categories, setCategories] = useState(['all'])
+ const [useAgent, setUseAgent] = useState(false)
+ const [mcResults, setMcResults] = useState(null)
const [history, setHistory] = useState<{ url: string; date: string; provider: string; violations: number; pct: number; resultKey: string }[]>(() => {
if (typeof window === 'undefined') return []
try { return JSON.parse(localStorage.getItem('banner-check-history') || '[]') } catch { return [] }
@@ -97,6 +99,36 @@ export function BannerCheckTab() {
setResult(data)
localStorage.setItem('banner-check-result', JSON.stringify(data))
+ // If agent mode: also run cookie doc-check with 381 MCs
+ if (useAgent) {
+ setProgress('KI-Agent prueft Cookie-Richtlinie (381 MCs)...')
+ try {
+ const mcRes = await fetch('/api/sdk/v1/agent/doc-check', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ entries: [{ doc_type: 'cookie', label: 'Cookie-Richtlinie', url: url.trim() }],
+ recipient: 'dsb@breakpilot.local',
+ use_agent: true,
+ }),
+ })
+ if (mcRes.ok) {
+ const { check_id } = await mcRes.json()
+ if (check_id) {
+ for (let i = 0; i < 60; i++) {
+ await new Promise(r => setTimeout(r, 3000))
+ const poll = await fetch(`/api/sdk/v1/agent/doc-check?check_id=${check_id}`)
+ if (!poll.ok) continue
+ const pd = await poll.json()
+ if (pd.progress) setProgress(`KI-Agent: ${pd.progress}`)
+ if (pd.status === 'completed' && pd.result) { setMcResults(pd.result); break }
+ if (pd.status === 'failed') break
+ }
+ }
+ }
+ } catch { /* agent check is optional */ }
+ }
+
// Add to history with persistent result
const violations = data.structured_checks?.filter((c: CheckItem) => !c.passed && !c.skipped).length || 0
const resultKey = `banner-check-result-${Date.now()}`
@@ -162,6 +194,16 @@ export function BannerCheckTab() {
+
+
+
+