mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 23:41:08 +02:00
Phase 4-5 of BYOK. Wires the BYOK backend into the running app and gives users a UI to manage their keys. Data layer (_byokKeys table, v16 schema): - Encrypted at rest via user master key (wrapValue/unwrapValue) - NOT in SYNC_APP_MAP — keys stay device-local on purpose - Tracks per-key usage: count, total tokens, cumulative USD cost byokVault API (lib/byok/): - listAll() / listMeta() — decrypt on read - create() — encrypts + auto-handles isDefault collisions - update() — label/model/isDefault edits (not the key itself) - delete() — soft-delete - recordUsage() — called from backend's onUsage callback - getForProvider() — resolver helper initByok() wires the ByokBackend into the shared orchestrator at app startup. The resolver picks the most-recently-used provider's key by default. Usage callback updates the key's counters + cost via estimateCost(). Settings page (/settings/ai-keys): - List existing keys with provider, label, model, usage stats - Add form: provider picker, label, API key (password input), model selector with provider defaults, isDefault toggle - Inline edit for label + model - Set-as-default action - Soft-delete with confirmation - Gracefully handles locked vault state Companion chat dropdown already picks up the new 'byok' tier from ALL_TIERS — user can select BYOK directly as KI-Modus. Total BYOK implementation: ~1500 LOC across 12 files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| api | ||
| calc/packages/shared | ||
| calendar | ||
| cards | ||
| chat | ||
| citycorners | ||
| contacts | ||
| context | ||
| docs | ||
| guides | ||
| inventory | ||
| mana | ||
| manavoxel | ||
| memoro | ||
| moodlit | ||
| mukke | ||
| news | ||
| nutriphi | ||
| photos | ||
| picture | ||
| plants | ||
| presi | ||
| questions | ||
| skilltree | ||
| storage | ||
| times | ||
| todo | ||
| traces | ||
| uload | ||
| zitare/packages/content | ||