feat: refactor initializers to support async and sync execution

This commit is contained in:
Yeuoly
2026-01-22 19:54:54 +08:00
parent 55c588a03a
commit a3cf73b220
8 changed files with 31 additions and 39 deletions

View File

@ -5,10 +5,12 @@ from core.sandbox.sandbox import Sandbox
class SandboxInitializer(ABC):
@abstractmethod
def initialize(self, env: Sandbox) -> None: ...
def initialize(self, sandbox: Sandbox) -> None: ...
def async_initialize(self) -> bool:
"""
Whether the initializer needs to run asynchronously.
"""
return False
class SyncSandboxInitializer(SandboxInitializer):
"""Marker class for initializers that must run before async setup."""
class AsyncSandboxInitializer(SandboxInitializer):
"""Marker class for initializers that can run in the background."""