summaryrefslogtreecommitdiff
path: root/continuedev/src/continuedev/server
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-06-02 00:57:57 -0400
committerNate Sesti <sestinj@gmail.com>2023-06-02 00:57:57 -0400
commit769bf31da03f4c5d3145d885cff897109d63f246 (patch)
tree4875085a14a9ddfae9c3c2741dd6cc0a7c73d286 /continuedev/src/continuedev/server
parent3ff98317831d80436b266b424a2613fcf1d7205c (diff)
downloadsncontinue-769bf31da03f4c5d3145d885cff897109d63f246.tar.gz
sncontinue-769bf31da03f4c5d3145d885cff897109d63f246.tar.bz2
sncontinue-769bf31da03f4c5d3145d885cff897109d63f246.zip
agent -> autopilot
Diffstat (limited to 'continuedev/src/continuedev/server')
-rw-r--r--continuedev/src/continuedev/server/ide.py16
-rw-r--r--continuedev/src/continuedev/server/notebook.py10
-rw-r--r--continuedev/src/continuedev/server/session_manager.py20
3 files changed, 23 insertions, 23 deletions
diff --git a/continuedev/src/continuedev/server/ide.py b/continuedev/src/continuedev/server/ide.py
index 50296841..32f0b3ba 100644
--- a/continuedev/src/continuedev/server/ide.py
+++ b/continuedev/src/continuedev/server/ide.py
@@ -125,7 +125,7 @@ class IdeProtocolServer(AbstractIdeProtocolServer):
pass
async def setFileOpen(self, filepath: str, open: bool = True):
- # Agent needs access to this.
+ # Autopilot needs access to this.
await self._send_json("setFileOpen", {
"filepath": filepath,
"open": open
@@ -147,12 +147,12 @@ class IdeProtocolServer(AbstractIdeProtocolServer):
responses = await asyncio.gather(*[
self._receive_json(ShowSuggestionResponse)
for i in range(len(suggestions))
- ]) # WORKING ON THIS FLOW HERE. Fine now to just await for response, instead of doing something fancy with a "waiting" state on the agent.
+ ]) # WORKING ON THIS FLOW HERE. Fine now to just await for response, instead of doing something fancy with a "waiting" state on the autopilot.
# Just need connect the suggestionId to the IDE (and the notebook)
return any([r.accepted for r in responses])
# ------------------------------- #
- # Here needs to pass message onto the Agent OR Agent just subscribes.
+ # Here needs to pass message onto the Autopilot OR Autopilot just subscribes.
# This is where you might have triggers: plugins can subscribe to certian events
# like file changes, tracebacks, etc...
@@ -160,12 +160,12 @@ class IdeProtocolServer(AbstractIdeProtocolServer):
pass
def onTraceback(self, traceback: Traceback):
- # Same as below, maybe not every agent?
+ # Same as below, maybe not every autopilot?
for _, session in self.session_manager.sessions.items():
- session.agent.handle_traceback(traceback)
+ session.autopilot.handle_traceback(traceback)
def onFileSystemUpdate(self, update: FileSystemEdit):
- # Access to Agent (so SessionManager)
+ # Access to Autopilot (so SessionManager)
pass
def onCloseNotebook(self, session_id: str):
@@ -176,10 +176,10 @@ class IdeProtocolServer(AbstractIdeProtocolServer):
pass
def onFileEdits(self, edits: List[FileEditWithFullContents]):
- # Send the file edits to ALL agents.
+ # Send the file edits to ALL autopilots.
# Maybe not ideal behavior
for _, session in self.session_manager.sessions.items():
- session.agent.handle_manual_edits(edits)
+ session.autopilot.handle_manual_edits(edits)
# Request information. Session doesn't matter.
async def getOpenFiles(self) -> List[str]:
diff --git a/continuedev/src/continuedev/server/notebook.py b/continuedev/src/continuedev/server/notebook.py
index 9ca510dd..8ebe2853 100644
--- a/continuedev/src/continuedev/server/notebook.py
+++ b/continuedev/src/continuedev/server/notebook.py
@@ -79,26 +79,26 @@ class NotebookProtocolServer(AbstractNotebookProtocolServer):
print(e)
async def send_state_update(self):
- state = self.session.agent.get_full_state().dict()
+ state = self.session.autopilot.get_full_state().dict()
await self._send_json("state_update", {
"state": state
})
def on_main_input(self, input: str):
# Do something with user input
- asyncio.create_task(self.session.agent.accept_user_input(input))
+ asyncio.create_task(self.session.autopilot.accept_user_input(input))
def on_reverse_to_index(self, index: int):
# Reverse the history to the given index
- asyncio.create_task(self.session.agent.reverse_to_index(index))
+ asyncio.create_task(self.session.autopilot.reverse_to_index(index))
def on_step_user_input(self, input: str, index: int):
asyncio.create_task(
- self.session.agent.give_user_input(input, index))
+ self.session.autopilot.give_user_input(input, index))
def on_refinement_input(self, input: str, index: int):
asyncio.create_task(
- self.session.agent.accept_refinement_input(input, index))
+ self.session.autopilot.accept_refinement_input(input, index))
@router.websocket("/ws")
diff --git a/continuedev/src/continuedev/server/session_manager.py b/continuedev/src/continuedev/server/session_manager.py
index c5715034..5598e140 100644
--- a/continuedev/src/continuedev/server/session_manager.py
+++ b/continuedev/src/continuedev/server/session_manager.py
@@ -5,7 +5,7 @@ from uuid import uuid4
from ..models.filesystem_edit import FileEditWithFullContents
from ..core.policy import DemoPolicy
from ..core.main import FullState
-from ..core.agent import Agent
+from ..core.autopilot import Autopilot
from ..libs.steps.nate import ImplementAbstractMethodStep
from .ide_protocol import AbstractIdeProtocolServer
import asyncio
@@ -15,16 +15,16 @@ nest_asyncio.apply()
class Session:
session_id: str
- agent: Agent
+ autopilot: Autopilot
ws: Union[WebSocket, None]
- def __init__(self, session_id: str, agent: Agent):
+ def __init__(self, session_id: str, autopilot: Autopilot):
self.session_id = session_id
- self.agent = agent
+ self.autopilot = autopilot
self.ws = None
-class DemoAgent(Agent):
+class DemoAutopilot(Autopilot):
first_seen: bool = False
cumulative_edit_string = ""
@@ -51,18 +51,18 @@ class SessionManager:
return self.sessions[session_id]
def new_session(self, ide: AbstractIdeProtocolServer) -> str:
- agent = DemoAgent(policy=DemoPolicy(), ide=ide)
+ autopilot = DemoAutopilot(policy=DemoPolicy(), ide=ide)
session_id = str(uuid4())
- session = Session(session_id=session_id, agent=agent)
+ session = Session(session_id=session_id, autopilot=autopilot)
self.sessions[session_id] = session
async def on_update(state: FullState):
await session_manager.send_ws_data(session_id, "state_update", {
- "state": agent.get_full_state().dict()
+ "state": autopilot.get_full_state().dict()
})
- agent.on_update(on_update)
- asyncio.create_task(agent.run_policy())
+ autopilot.on_update(on_update)
+ asyncio.create_task(autopilot.run_policy())
return session_id
def remove_session(self, session_id: str):