from __future__ import annotations from asyncio import Queue from typing import Any, Protocol from api.repositories.task_store import TaskRecord class TaskServiceProtocol(Protocol): async def submit_task(self, task: str, timeout: int, metadata: dict | None) -> TaskRecord: ... async def get_task(self, task_id: str) -> TaskRecord | None: ... async def create_run(self, thread_id: str, user_input: str, timeout: int, metadata: dict | None) -> TaskRecord: ... async def get_run(self, run_id: str) -> TaskRecord | None: ... async def list_thread_runs(self, thread_id: str) -> list[TaskRecord]: ... async def cancel_run(self, run_id: str) -> TaskRecord | None: ... async def delete_run(self, run_id: str) -> tuple[bool, bool]: ... async def wait_run(self, run_id: str, timeout: float | None = None) -> TaskRecord | None: ... async def subscribe_run_stream(self, run_id: str) -> Queue[dict[str, Any]] | None: ... async def unsubscribe_run_stream(self, run_id: str, queue: Queue[dict[str, Any]]) -> None: ... async def notify_captcha( self, task_id: str, kind: str | None, reason: str | None, view_url: str | None, timeout_seconds: int, ) -> TaskRecord | None: ... async def mark_captcha_solved(self, task_id: str, detector: str | None = None) -> TaskRecord | None: ... async def extend_captcha(self, task_id: str, extra_seconds: int) -> TaskRecord | None: ... async def abort_captcha(self, task_id: str, reason: str | None = None) -> TaskRecord | None: ... async def prompt_captcha_timeout(self, task_id: str) -> TaskRecord | None: ... async def wait_captcha(self, task_id: str, timeout: float) -> TaskRecord | None: ...