feat(iace): FMEA source-document register + Anthropic extraction (Haiku)

Quote-verifiable failure extraction via Claude (Haiku 4.5): PDF sent
directly, tool-schema forces verbatim source quotes + applicable flag +
confidence — replaces the unreliable local llama run. Only applicable=true
tuples ingest into bp_iace_failure_kb; every processed doc lands in the
source manifest.

Frontend: FMEA tab now shows a "Quelldokumente" register (every document we
use, with source + licence + link + what was extracted) served from the
embedded manifest via GET /iace/failure-knowledge/sources. Manifest is
placeholder until the 100-doc Haiku run is folded in.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-13 13:34:41 +02:00
parent f1ac45dacf
commit 445079cfb2
9 changed files with 395 additions and 0 deletions
@@ -0,0 +1,46 @@
'use client'
import { useEffect, useState } from 'react'
export interface FailureSourceDoc {
id: number
title: string
source: string
license: string
url: string
used: boolean
component: string
failure_mode: string
confidence: string
}
export interface FailureSources {
generated: string
model: string
count: number
documents: FailureSourceDoc[]
}
/**
* Loads the FMEA source-document register (every document we use, with source +
* licence). Global, not per project — the auditable provenance of the
* failure-knowledge corpus.
*/
export function useFailureSources() {
const [data, setData] = useState<FailureSources | null>(null)
useEffect(() => {
let cancelled = false
fetch('/api/sdk/v1/iace/failure-knowledge/sources')
.then((r) => (r.ok ? r.json() : null))
.then((j) => {
if (!cancelled) setData(j)
})
.catch((err) => console.error('Failed to load failure sources:', err))
return () => {
cancelled = true
}
}, [])
return { data }
}