feat: add guarded savings agent tools

This commit is contained in:
Matthias
2026-06-23 21:13:02 +02:00
parent 6e687dc9b5
commit b7dae31fe1
22 changed files with 3510 additions and 73 deletions

View File

@@ -0,0 +1,45 @@
---
id: TASK-14
title: Plane Kontostandabruf und UI-Anzeige
status: In Progress
assignee: []
created_date: '2026-06-23 09:57'
updated_date: '2026-06-23 10:18'
labels: []
dependencies: []
priority: high
ordinal: 14000
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Architektur- und Umsetzungsplan für Live-Kontostände über FinTS und comdirect REST, inklusive Persistenzmodell, Sync-Route und Dashboard/UI-Anzeige.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Der Plan beschreibt die Datenmodell-Erweiterung für aktuelle Kontostände und Abruf-Metadaten.
- [x] #2 Der Plan beschreibt getrennte Abrufpfade für FinTS und comdirect REST mit Auto/Fallback-Verhalten.
- [x] #3 Der Plan beschreibt eine Dashboard- und Konto-UI für Kontostände inklusive Lade-, Fehler- und Veraltet-Zuständen.
- [x] #4 Der Plan nennt konkrete Dateien, Tests und Validierungsschritte für eine spätere Implementierung.
<!-- AC:END -->
## Implementation Plan
<!-- SECTION:PLAN:BEGIN -->
1. Modell für Live-Kontostände ergänzen
2. Provider-Abrufpfade für comdirect REST und FinTS vereinheitlichen
3. Public Convex Route/Action für reinen Saldoabruf planen
4. Persistenz und Sync-State für Salden aktualisieren
5. Dashboard- und Konten-UI für aktuelle Salden ergänzen
6. Tests für Mapping, Persistenz, Fallback und UI-Zustände definieren
<!-- SECTION:PLAN:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
Plan dokumentiert in docs/superpowers/plans/2026-06-23-kontostandabruf-ui.md. ctx7: FinTS-Doku gefunden (/nemiah/phpfints), comdirect API in ctx7 nicht brauchbar gefunden; Planung nutzt vorhandenen lokalen comdirect REST Client.
Umsetzung: accountBalances Schema + interne Upsert-Query ergänzt; public api.bank.balances.listLatest/refresh hinzugefügt; comdirect Balance-Mapping und Balance-only Fetch ergänzt; FinTS HKSAL Helper extrahiert; Full-Sync persistiert aktuelle Salden; Dashboard zeigt AccountBalanceStrip; Settings zeigt Live-Saldo pro Konto. Verifiziert: pnpm vitest run convex/balances.test.ts convex/bank/balanceProviders.test.ts src/components/accounts/AccountBalanceStrip.test.tsx; pnpm build; eslint auf neuen/berührten Kern-Dateien ohne Fehler. Vollständiges pnpm lint scheitert weiterhin an bestehenden unrelated Regeln in anderen Dateien.
<!-- SECTION:NOTES:END -->

View File

@@ -0,0 +1,41 @@
---
id: TASK-16
title: Add guarded agent tools
status: Done
assignee: []
created_date: '2026-06-23 11:55'
updated_date: '2026-06-23 19:12'
labels: []
dependencies: []
priority: high
ordinal: 16000
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Build AI agent tools for category health, category suggestions, guarded category write plans, and current-month spending preview.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Read-only agent tools cover category health, category suggestions, and current-month expense preview
- [x] #2 Write-capable agent tools create pending action plans without directly changing data
- [x] #3 Pending action plans can be listed, applied, and dismissed from the chat UI
- [x] #4 Applying action plans revalidates ownership, status, expiry, and operation limits
- [x] #5 Convex and UI tests cover the new tool and confirmation behavior
<!-- AC:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
Implemented guarded agent tool package. Verification: npx vitest run passed (14 files, 79 tests); npm run build passed. npm run lint still fails on pre-existing unrelated files (bank/config.ts, TanAwaitDialog, fast-refresh/export warnings, SettingsPage effect), with no remaining lint error from the new action-plan module.
Post-review hardening: added tests and fixes for empty category names, duplicate category renames, stale transaction category plans, and expired plans. Re-verified: convex/savingsChat.test.ts 33 passed; full npx vitest run 81 passed; npm run build passed; npx convex codegen passed.
<!-- SECTION:NOTES:END -->
## Final Summary
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Implemented guarded AI agent tools with current-month expense preview, category health/suggestion tools, pending action plans, UI apply/dismiss controls, and post-review validation hardening. Verified with full Vitest suite, build, and Convex codegen; lint remains blocked by pre-existing unrelated project issues.
<!-- SECTION:FINAL_SUMMARY:END -->