plugin_daemon.py 779 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. from enum import Enum
  2. from typing import Generic, Optional, TypeVar
  3. from pydantic import BaseModel
  4. from core.tools.entities.tool_entities import ToolProviderEntityWithPlugin
  5. T = TypeVar("T", bound=(BaseModel | dict | list | bool))
  6. class PluginDaemonBasicResponse(BaseModel, Generic[T]):
  7. """
  8. Basic response from plugin daemon.
  9. """
  10. code: int
  11. message: str
  12. data: Optional[T]
  13. class InstallPluginMessage(BaseModel):
  14. """
  15. Message for installing a plugin.
  16. """
  17. class Event(Enum):
  18. Info = "info"
  19. Done = "done"
  20. Error = "error"
  21. event: Event
  22. data: str
  23. class PluginToolProviderEntity(BaseModel):
  24. provider: str
  25. plugin_unique_identifier: str
  26. plugin_id: str
  27. declaration: ToolProviderEntityWithPlugin