feat(advisor): atom-grain controls in agent context

controls-augmentation now renders control_id + sub_topic + source_regulation
(handles both atom-grain and master-grain API shapes). The compliance-advisor
answers from atom_classification (precise, sub-topic-organized, framework-
traceable) via the shared get_controls_for_use_case API. 100% local at runtime.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-14 09:52:50 +02:00
parent 4d01e99ca1
commit 05bd0418f8
@@ -19,14 +19,17 @@ export interface UseCaseLite {
} }
interface ControlLite { interface ControlLite {
master_control_id: string control_id?: string
master_control_id?: string
title: string title: string
sub_topic?: string | null
source_regulation?: string | null
primary_regulation?: string | null primary_regulation?: string | null
is_primary?: boolean
} }
interface ControlsResponse { interface ControlsResponse {
total?: number total?: number
granularity?: string
controls?: ControlLite[] controls?: ControlLite[]
} }
@@ -105,8 +108,11 @@ export async function buildControlsContext(message: string): Promise<string> {
const total = data?.total ?? controls.length const total = data?.total ?? controls.length
const lines = controls.map((c, i) => { const lines = controls.map((c, i) => {
const reg = c.primary_regulation ? ` — Quelle: ${c.primary_regulation}` : '' const cid = c.control_id || c.master_control_id || '?'
return `${i + 1}. [${c.master_control_id}] ${c.title}${reg}` const sub = c.sub_topic ? ` · ${c.sub_topic}` : ''
const src = c.source_regulation || c.primary_regulation
const reg = src ? ` — Quelle: ${src}` : ''
return `${i + 1}. [${cid}]${sub} ${c.title}${reg}`
}) })
return `## Strukturierte Controls aus der Datenbank — Thema: ${uc.label} return `## Strukturierte Controls aus der Datenbank — Thema: ${uc.label}