Files
breakpilot-compliance/backend-compliance/compliance/api/__init__.py
T
Benjamin Admin 3ae4e60c9d
CI / detect-changes (push) Successful in 7s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / secret-scan (push) Has been skipped
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / build-sha-integrity (push) Failing after 4s
CI / validate-canonical-controls (push) Successful in 12s
CI / loc-budget (push) Successful in 14s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 2m24s
CI / test-go (push) Has been skipped
CI / iace-gt-coverage (push) Has been skipped
CI / test-python-backend (push) Successful in 29s
CI / test-python-document-crawler (push) Has been skipped
CI / test-python-dsms-gateway (push) Has been skipped
feat(agents): SSE-Endpoint + Agent-Test-Tab (5-URL parallel)
Backend:
- specialist_agent_routes.py: GET /agents, POST /test/start (run_id),
  GET /test/stream/{run_id} (SSE), GET /run/{run_id}/result,
  GET /run/{run_id}/artifacts, GET /run/{run_id}/artifact/{path},
  DELETE /run/{run_id}, GET /runs.
- Per-URL async orchestrator: text fetch via consent-tester
  dsi-discovery → agent.evaluate() → vault.put_json + stream events.
- Tests: 7/7 grün.

Frontend:
- /api/sdk/v1/specialist-agent proxy mit SSE-passthrough.
- AgentTestTab.tsx: Agent-Wähler + 5 URL-Slots + Live-Events +
  Speedometer (OK/N-A/HIGH/MEDIUM/LOW) + Findings + Recommendations +
  Eskalations-Log + Artefakt-Link pro Slot.
- Neuer Tab "Agent-Test" in /sdk/agent.

User-Wunsch 2026-06-08: pro Agent isoliert testen, 5 URLs gleichzeitig,
Live-Updates statt Polling-Wartespiel.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-08 17:47:05 +02:00

90 lines
2.3 KiB
Python

"""API routes for Compliance module."""
import logging
from .routes import router
logger = logging.getLogger(__name__)
_failed_routers: dict[str, str] = {}
def _safe_import_router(module_name: str, attr: str = "router"):
"""Import a router module safely — log error but don't crash the whole app."""
try:
mod = __import__(f"compliance.api.{module_name}", fromlist=[attr])
return getattr(mod, attr)
except Exception as e:
logger.error("Failed to import %s: %s", module_name, e)
_failed_routers[module_name] = str(e)
return None
# Import all sub-routers (safe — failure of one doesn't block others)
_ROUTER_MODULES = [
"audit_routes",
"ai_routes",
"evidence_routes",
"risk_routes",
"dashboard_routes",
"scraper_routes",
"module_routes",
"isms_routes",
"vvt_routes",
"legal_document_routes",
"einwilligungen_routes",
"einwilligungen_export_routes",
"escalation_routes",
"consent_template_routes",
"notfallplan_routes",
"obligation_routes",
"security_backlog_routes",
"quality_routes",
"loeschfristen_routes",
"legal_template_routes",
"compliance_scope_routes",
"dsfa_routes",
"dsr_routes",
"email_template_routes",
"banner_routes",
"extraction_routes",
"tom_routes",
"vendor_compliance_routes",
"incident_routes",
"change_request_routes",
"generation_routes",
"project_routes",
"wiki_routes",
"canonical_control_routes",
"control_generator_routes",
"crosswalk_routes",
"process_task_routes",
"evidence_check_routes",
"vvt_library_routes",
"tom_mapping_routes",
"llm_audit_routes",
"assertion_routes",
"org_role_routes",
"document_review_routes",
"banner_analytics_routes",
"banner_ab_routes",
"compliance_report_routes",
"whistleblower_routes",
"tcf_routes",
"founding_wizard_routes",
"licenses_routes",
"template_rule_routes",
"specialist_agent_routes",
]
_loaded_count = 0
for _mod_name in _ROUTER_MODULES:
_sub_router = _safe_import_router(_mod_name)
if _sub_router is not None:
router.include_router(_sub_router)
_loaded_count += 1
logger.info("Loaded %d/%d compliance sub-routers", _loaded_count, len(_ROUTER_MODULES))
__all__ = ["router"]