refactor(types): host ObjectPermissionDict in litellm/types/ for SDK reuse

Defines the TypedDict mirror of LiteLLM_ObjectPermissionBase under
litellm/types/object_permission.py so SDK-side modules can adopt the
type without violating the SDK-must-not-import-from-proxy layering
rule. litellm/proxy/_types.py re-exports it for existing callers.

Supports the validator-surface retypes in the preceding proxy refactor
commit.
This commit is contained in:
yucheng-berriai 2026-06-26 17:39:10 -07:00
parent f2d7cb152a
commit b9e58758e0
2 changed files with 29 additions and 17 deletions

View file

@ -1005,23 +1005,9 @@ class LiteLLM_ObjectPermissionBase(LiteLLMPydanticObjectBase):
search_tools: Optional[List[str]] = None
class ObjectPermissionDict(TypedDict, total=False):
"""Plain-dict mirror of LiteLLM_ObjectPermissionBase used by validators
that need to mutate the payload before persistence (e.g. MCP server
identifier normalization in object_permission_utils)."""
mcp_servers: Optional[list[str]]
mcp_access_groups: Optional[list[str]]
mcp_tool_permissions: Optional[dict[str, list[str]]]
mcp_toolsets: Optional[list[str]]
blocked_tools: Optional[list[str]]
vector_stores: Optional[list[str]]
agents: Optional[list[str]]
agent_access_groups: Optional[list[str]]
models: Optional[list[str]]
search_tools: Optional[list[str]]
from litellm.types.object_permission import ( # noqa: E402
ObjectPermissionDict as ObjectPermissionDict,
)
from litellm.models.team import BudgetLimitEntry as BudgetLimitEntry # noqa: E402

View file

@ -0,0 +1,26 @@
"""
TypedDict mirror of ``LiteLLM_ObjectPermissionBase`` for in-memory dict
payloads passed through validators that mutate before persistence (e.g.
MCP server identifier normalization in object_permission_utils).
Lives in ``litellm/types/`` so SDK-side modules (``litellm.types.agents``)
can adopt the type without violating the SDK-must-not-import-from-proxy
layering rule.
"""
from typing import Optional
from typing_extensions import TypedDict
class ObjectPermissionDict(TypedDict, total=False):
mcp_servers: Optional[list[str]]
mcp_access_groups: Optional[list[str]]
mcp_tool_permissions: Optional[dict[str, list[str]]]
mcp_toolsets: Optional[list[str]]
blocked_tools: Optional[list[str]]
vector_stores: Optional[list[str]]
agents: Optional[list[str]]
agent_access_groups: Optional[list[str]]
models: Optional[list[str]]
search_tools: Optional[list[str]]