File size: 1,028 Bytes
249942d
 
 
 
 
 
6d4f152
249942d
 
 
6d4f152
 
 
 
249942d
 
e660ef7
249942d
 
 
 
 
 
 
 
 
 
 
6d4f152
cfa0cbb
1f27d6a
6d4f152
 
249942d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Base orchestrator — abstract interface for all chat orchestrators."""

from __future__ import annotations

from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING

from config.settings import settings

if TYPE_CHECKING:
    from agents.agent_flow import ChatTurnResponse
    from agents.design_state import DesignState


class BaseOrchestrator(ABC):
    """Abstract base for MockChatBackend and CrewOrchestrator."""

    def __init__(self, output_dir: Path | str | None = None):
        self.output_dir = Path(output_dir) if output_dir else settings.output_dir
        self.output_dir.mkdir(parents=True, exist_ok=True)

    @abstractmethod
    def chat_turn(
        self,
        message: str,
        history: list[dict],
        mentions: list[str] | None = None,
        design_state: DesignState | None = None,
        plan_context: bool = False,
        model: str | None = None,
    ) -> ChatTurnResponse:
        """Run one chat turn. Returns ChatTurnResponse."""
        ...