[Haik]: cleaned up oauth logic so theres a single OAuthService class that handles logic only, then all endpoints and stores are handled in the tools subapp. Now gonna rename the oauth folder and fix imports

This commit is contained in:
haikdc
2026-04-05 15:44:35 -07:00
parent 60f554de6a
commit 7dfbe21787
4 changed files with 322 additions and 281 deletions
@@ -1,9 +1,10 @@
from typing_extensions import Dict
from pydantic import BaseModel, Field
from typing import Optional, Any
from uuid import uuid4
from backend.core.tools.shared_structs.TOOL_PERMISSIONS import TOOL_PERMISSIONS
# TODO: better type specing of this whole class, also we may not even need this class????
class ToolDefinition(BaseModel):
model_config = {"extra": "ignore"}
@@ -11,13 +12,13 @@ class ToolDefinition(BaseModel):
name: str
description: str = ""
command: str = ""
mcp_config: dict[str, Any] = Field(default_factory=dict)
credentials: dict[str, str] = Field(default_factory=dict)
mcp_config: Dict[str, Any] = Field(default_factory=dict)
credentials: Dict[str, str] = Field(default_factory=dict)
auth_type: str = "none"
auth_status: str = "none"
oauth_provider: Optional[str] = None
oauth_tokens: dict[str, Any] = Field(default_factory=dict)
tool_permissions: dict[str, TOOL_PERMISSIONS] = Field(default_factory=dict)
tool_descriptions: dict[str, str] = Field(default_factory=dict) # tool_descriptions[tool_name] = tool_description
oauth_tokens: Dict[str, Any] = Field(default_factory=dict)
tool_permissions: Dict[str, TOOL_PERMISSIONS] = Field(default_factory=dict)
tool_descriptions: Dict[str, str] = Field(default_factory=dict) # tool_descriptions[tool_name] = tool_description
connected_account_email: Optional[str] = None
enabled: bool = True