feat(api-keys): let manage_kbs cover full KB lifecycle routes

Align create/copy/duplicate with update/delete under manage_kbs or
full-access, and update capability docs and UI hints accordingly.
This commit is contained in:
wizardchen
2026-07-15 10:40:32 +08:00
committed by lyingbug
parent be88a56245
commit e3b7ad98c2
8 changed files with 64 additions and 47 deletions
+10 -4
View File
@@ -60,10 +60,16 @@ const (
// bases or agents, nor destructive KB clears, and the key's
// knowledge_base_ids allow-list still bounds every write.
APIKeyCapabilityIngest APIKeyCapability = "ingest"
// APIKeyCapabilityManageKnowledgeBases lets a scoped key manage existing
// knowledge-base metadata/configuration within its allowed KB scope. It is
// separate from ingest: uploading or editing KB contents does not imply
// permission to rename, reconfigure, or delete the KB itself.
// APIKeyCapabilityManageKnowledgeBases lets a scoped key manage the full
// knowledge-base lifecycle: create, copy, duplicate, rename/reconfigure,
// and delete. For operations that target an existing KB (copy/duplicate
// source, update, delete) the key's allowed KB scope still bounds which
// KBs it may touch; create has no source to bound against, so a
// scope-restricted key may add a new KB to its tenant (same-tenant, no
// cross-tenant reach — the new KB simply falls outside the key's
// allow-list and stays unmanageable by it). It is separate from ingest:
// uploading or editing KB contents does not imply permission to manage
// the KB itself.
APIKeyCapabilityManageKnowledgeBases APIKeyCapability = "manage_kbs"
// APIKeyCapabilityManageAgents lets a key create/read/update/delete/copy
// agents. Agent config can carry sensitive model/MCP bindings, so this is