feat(settings): protect model provider deletion and cascade credential updates

- Block deletion of a model provider when it is referenced by any agent,
  returning an error that lists the agent names so the user knows what to unlink first
- When a provider's api_url or api_key is updated, automatically propagate
  the new credentials to all dependent agents: updates env_json in the database
  and patches on-disk config files (Claude Code settings.json, Gemini settings.json,
  Codex auth.json + config.toml, OpenCode auth.json) using the same field names
  and structure as the agent settings UI
- Fix error message display in provider dialogs for both Tauri and web transports,
  which throw plain objects rather than Error instances

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-07 00:25:01 +08:00
parent 4245df2f4a
commit a3d5335e7f
17 changed files with 254 additions and 41 deletions

View File

@@ -1849,6 +1849,7 @@
"deleteSuccess": "供應商已刪除。",
"deleteConfirmTitle": "刪除供應商",
"deleteConfirmMessage": "確定要永久刪除供應商「{name}」嗎?",
"deleteBlockedByAgent": "{agents} 正在使用此設定,請先解除關聯後再刪除。",
"cancel": "取消",
"delete": "刪除",
"create": "建立",