Первый коммит

This commit is contained in:
2026-02-25 14:47:19 +03:00
commit 43c404f958
171 changed files with 4917 additions and 0 deletions

47
app/modules/contracts.py Normal file
View File

@@ -0,0 +1,47 @@
from typing import Protocol
from collections.abc import Awaitable, Callable
from app.schemas.changeset import ChangeItem
from app.schemas.chat import TaskResultType
class AgentRunResult(Protocol):
result_type: TaskResultType
answer: str | None
changeset: list[ChangeItem]
meta: dict
class AgentRunner(Protocol):
async def run(
self,
*,
task_id: str,
dialog_session_id: str,
rag_session_id: str,
mode: str,
message: str,
attachments: list[dict],
files: list[dict],
progress_cb: Callable[[str, str, str, dict | None], Awaitable[None] | None] | None = None,
) -> AgentRunResult: ...
class RagRetriever(Protocol):
async def retrieve(self, rag_session_id: str, query: str) -> list[dict]: ...
class RagIndexer(Protocol):
async def index_snapshot(
self,
rag_session_id: str,
files: list[dict],
progress_cb: Callable[[int, int, str], Awaitable[None] | None] | None = None,
) -> tuple[int, int]: ...
async def index_changes(
self,
rag_session_id: str,
changed_files: list[dict],
progress_cb: Callable[[int, int, str], Awaitable[None] | None] | None = None,
) -> tuple[int, int]: ...