L10b Betrieb & Aufräumen: Lotse-Betrieb – Aufbewahrung KI-Protokoll und Token-Kontingent

Aufräumpunkt k (Spec §31):
- Aufbewahrung: services/lotse/retention.ts leert input/output und createdById von
  AiGeneration-Einträgen älter als AI_GENERATION_RETENTION_DAYS (Default 180), Metadaten bleiben,
  Audit je Mandant. Queue/Processor ai-retention, täglicher BullMQ-Job-Scheduler beim Start des
  craftvia-worker.
- Kontingent: services/lotse/budget.ts (Tokens ein+aus je Kalendermonat, TenantSettings-Wert vor
  Env AI_MONTHLY_TOKEN_LIMIT, 0 = unbegrenzt). Lotse-Entwurf und Sprachnotiz-Zusammenfassung
  → blocked budget_exceeded mit Klartext; Import-Extraktion fällt auf manuelle Erfassung zurück
  (Hinweis ai_budget_exceeded). /settings/lotse: Kontingent setzen, Verbrauch anzeigen.
- scripts/test-betrieb-audit.ts: Audit nach Commit/Rollback/verschachtelt, Merge atomar und in
  äußerer Transaktion, Audit „read", Aufbewahrung (Frist, Metadaten, Idempotenz, Mandant B),
  Kontingent (Mandant/Env/Vormonat/unbegrenzt, Rollen, Audit).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 18:19:19 +02:00
co-authored by Claude Opus 5
parent 8aedc642ca
commit b0aedb5d23
19 changed files with 437 additions and 15 deletions
+7 -1
View File
@@ -76,7 +76,8 @@
"no_transcript": "The voice note has no text yet.",
"pending": "The transcription is still running.",
"conflict": "Changed in the meantime. Please reload the page.",
"invalid": "Please check your input."
"invalid": "Please check your input.",
"budget_exceeded": "This business has used up its monthly AI allowance. Please write the report yourself or ask the office."
},
"settings": {
"back": "Settings",
@@ -96,6 +97,11 @@
"du": "Informal (du)"
},
"save": "Save",
"budget": "Monthly AI allowance (tokens)",
"budgetHint": "Empty = platform default ({platform}). 0 = unlimited. Once used up, Lotse prepares nothing until the end of the month.",
"budgetUnlimited": "unlimited",
"budgetUsage": "Used since {since}: {used} of {limit}",
"budgetExceeded": "Allowance used up",
"dataTitle": "Which data goes where",
"draftProvider": "Report draft and summary",
"transcriptionProvider": "Voice note transcription",