requirement.py 850 B

123456789101112131415161718192021222324252627282930313233343536
  1. from abc import abstractmethod
  2. from dataclasses import dataclass
  3. from opendevin.events.action import Action
  4. from opendevin.events.observation import Observation
  5. class Plugin:
  6. """Base class for a plugin.
  7. This will be initialized by the runtime client, which will run inside docker.
  8. """
  9. name: str
  10. @abstractmethod
  11. async def initialize(self, username: str):
  12. """Initialize the plugin."""
  13. pass
  14. @abstractmethod
  15. async def run(self, action: Action) -> Observation:
  16. """Run the plugin for a given action."""
  17. pass
  18. @dataclass
  19. class PluginRequirement:
  20. """Requirement for a plugin."""
  21. name: str
  22. # FOLDER/FILES to be copied to the sandbox
  23. host_src: str
  24. sandbox_dest: str
  25. # NOTE: bash_script_path should be relative to the `sandbox_dest` path
  26. bash_script_path: str