plugin_daemon.py 906 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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
  28. class PluginBasicBooleanResponse(BaseModel):
  29. """
  30. Basic boolean response from plugin daemon.
  31. """
  32. result: bool