feat: F019 AI monitoring layer — output transparency & governance workspace

Full 2-panel workspace at /ops/ai-monitoring: metrics strip (total, failed,
pending, approval rate, top prompt version, active model), filterable output
table by type/status/error, and detail panel with output preview, prompt
versioning, error details, and role-aware review actions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Sutter
2026-05-17 13:11:35 +02:00
parent 5d3323617c
commit 71f4b1eeb6
16 changed files with 1164 additions and 265 deletions
+33 -14
View File
@@ -1,25 +1,44 @@
import type { ReviewStatus } from './enums'
export const AIOutputType = {
MATCH_SCORE: 'MATCH_SCORE',
EXPLAINABILITY: 'EXPLAINABILITY',
SIGNAL_EXTRACTION: 'SIGNAL_EXTRACTION',
NEED_PARSING: 'NEED_PARSING',
SUMMARY: 'SUMMARY',
RECOMMENDATION: 'RECOMMENDATION',
NEED_PARSE: 'NEED_PARSE',
FOLLOW_UP_QUESTIONS: 'FOLLOW_UP_QUESTIONS',
MATCH_EXPLANATION: 'MATCH_EXPLANATION',
COMPARE_SUMMARY: 'COMPARE_SUMMARY',
DECISION_BRIEF: 'DECISION_BRIEF',
DATA_QUALITY_SUMMARY: 'DATA_QUALITY_SUMMARY',
} as const
export type AIOutputType = typeof AIOutputType[keyof typeof AIOutputType]
export const AIErrorType = {
SCHEMA_VALIDATION: 'SCHEMA_VALIDATION',
PROVIDER_TIMEOUT: 'PROVIDER_TIMEOUT',
INVALID_JSON: 'INVALID_JSON',
EMPTY_RESPONSE: 'EMPTY_RESPONSE',
RATE_LIMIT: 'RATE_LIMIT',
} as const
export type AIErrorType = typeof AIErrorType[keyof typeof AIErrorType]
export interface AIOutputError {
type: AIErrorType
message: string
recoverable: boolean
}
export interface AIOutput {
id: string
type: AIOutputType
inputHash: string // hash of the input for cache/dedup
outputJson: unknown // raw output — typed per consumer
provider: string // e.g. "openai", "anthropic"
model: string // e.g. "gpt-4o", "claude-3-5-sonnet"
promptVersion: string // semver of the prompt template used
schemaVersion: string // semver of expected output schema
provider: string
model: string
promptVersion: string
schemaVersion: string
inputHash: string
outputPreview: string
createdAt: string
reviewedBy?: string
reviewStatus?: ReviewStatus
latencyMs?: number
costEstimate?: number
reviewStatus: ReviewStatus
relatedEntityType: string
relatedEntityId: string
error?: AIOutputError
}