summaryrefslogtreecommitdiff
path: root/server/continuedev/core/abstract_sdk.py
blob: fdb99d474aed53c9e19a84b4ef8d1219f89b56ca (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from abc import ABC, abstractmethod
from typing import Coroutine, List, Union

from ..models.filesystem_edit import FileSystemEdit
from .config import ContinueConfig
from .main import ChatMessage, History, Step
from .observation import Observation

"""
[[Generate]]
[Prompt]
Write an abstract class AbstractContinueSDK(ABC) that has all of the same methods as the ContinueSDK class, but without any implementation.
All methods should be documented with the same docstrings as the ContinueSDK class and have the same types.
[Context]
./sdk.py:ContinueSDK
"""


class AbstractContinueSDK(ABC):
    """The SDK provided as parameters to a step"""

    @property
    def history(self) -> History:
        return self.__autopilot.history

    @abstractmethod
    async def _ensure_absolute_path(self, path: str) -> str:
        pass

    @abstractmethod
    async def run_step(self, step: Step) -> Coroutine[Observation, None, None]:
        pass

    @abstractmethod
    async def apply_filesystem_edit(self, edit: FileSystemEdit):
        pass

    @abstractmethod
    async def wait_for_user_input(self) -> str:
        pass

    @abstractmethod
    async def wait_for_user_confirmation(self, prompt: str):
        pass

    @abstractmethod
    async def run(self, commands: Union[List[str], str], cwd: str = None):
        pass

    @abstractmethod
    async def edit_file(self, filename: str, prompt: str):
        pass

    @abstractmethod
    async def append_to_file(self, filename: str, content: str):
        pass

    @abstractmethod
    async def add_file(self, filename: str, content: Union[str, None]):
        pass

    @abstractmethod
    async def delete_file(self, filename: str):
        pass

    @abstractmethod
    async def add_directory(self, path: str):
        pass

    @abstractmethod
    async def delete_directory(self, path: str):
        pass

    config: ContinueConfig

    @abstractmethod
    def set_loading_message(self, message: str):
        pass

    @abstractmethod
    async def get_chat_context(self) -> List[ChatMessage]:
        pass