summaryrefslogtreecommitdiff
path: root/continuedev/src/continuedev/server
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-05-30 08:41:56 -0400
committerNate Sesti <sestinj@gmail.com>2023-05-30 08:41:56 -0400
commit9171567ebf2c0ddf7c430a160a50d0d47c0c991b (patch)
tree0a1f6c54ac719e472edc44c6643cd3ae258d0fb5 /continuedev/src/continuedev/server
parent5c049f2f3d797babb91c62ec752bf6a2c4c2f16a (diff)
downloadsncontinue-9171567ebf2c0ddf7c430a160a50d0d47c0c991b.tar.gz
sncontinue-9171567ebf2c0ddf7c430a160a50d0d47c0c991b.tar.bz2
sncontinue-9171567ebf2c0ddf7c430a160a50d0d47c0c991b.zip
rename agent to 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.py40
2 files changed, 28 insertions, 28 deletions
diff --git a/continuedev/src/continuedev/server/ide.py b/continuedev/src/continuedev/server/ide.py
index dd1dc463..167d9483 100644
--- a/continuedev/src/continuedev/server/ide.py
+++ b/continuedev/src/continuedev/server/ide.py
@@ -122,7 +122,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.websocket.send_json({
"messageType": "setFileOpen",
"filepath": filepath,
@@ -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 c9d4edc5..c26920f5 100644
--- a/continuedev/src/continuedev/server/notebook.py
+++ b/continuedev/src/continuedev/server/notebook.py
@@ -6,7 +6,7 @@ from uvicorn.main import Server
from ..models.filesystem_edit import FileEditWithFullContents
from ..libs.policy import DemoPolicy
-from ..libs.core import Agent, FullState, History, Step
+from ..libs.core import Autopilot, FullState, History, Step
from ..libs.steps.nate import ImplementAbstractMethodStep
from ..libs.observation import Observation
from dotenv import load_dotenv
@@ -41,16 +41,16 @@ Server.handle_exit = AppStatus.handle_exit
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 = ""
@@ -78,20 +78,20 @@ class SessionManager:
def new_session(self, ide: AbstractIdeProtocolServer) -> str:
cmd = "python3 /Users/natesesti/Desktop/continue/extension/examples/python/main.py"
- agent = DemoAgent(llm=OpenAI(api_key=openai_api_key),
- policy=DemoPolicy(cmd=cmd), ide=ide)
+ autopilot = DemoAutopilot(llm=OpenAI(api_key=openai_api_key),
+ policy=DemoPolicy(cmd=cmd), 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
def on_update(state: FullState):
session_manager.send_ws_data(session_id, {
"messageType": "state",
- "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):
@@ -147,7 +147,7 @@ async def websocket_endpoint(websocket: WebSocket, session: Session = Depends(we
# Update any history that may have happened before connection
await websocket.send_json({
"messageType": "state",
- "state": session_manager.get_session(session.session_id).agent.get_full_state().dict()
+ "state": session_manager.get_session(session.session_id).autopilot.get_full_state().dict()
})
print("Session started", data)
while AppStatus.should_exit is False:
@@ -162,17 +162,17 @@ async def websocket_endpoint(websocket: WebSocket, session: Session = Depends(we
if messageType == "main_input":
# Do something with user input
asyncio.create_task(
- session.agent.accept_user_input(data["value"]))
+ session.autopilot.accept_user_input(data["value"]))
elif messageType == "step_user_input":
asyncio.create_task(
- session.agent.give_user_input(data["value"], data["index"]))
+ session.autopilot.give_user_input(data["value"], data["index"]))
elif messageType == "refinement_input":
asyncio.create_task(
- session.agent.accept_refinement_input(data["value"], data["index"]))
+ session.autopilot.accept_refinement_input(data["value"], data["index"]))
elif messageType == "reverse":
# Reverse the history to the given index
asyncio.create_task(
- session.agent.reverse_to_index(data["index"]))
+ session.autopilot.reverse_to_index(data["index"]))
except Exception as e:
print(e)
@@ -182,17 +182,17 @@ async def websocket_endpoint(websocket: WebSocket, session: Session = Depends(we
@router.post("/run")
def request_run(step: Step, session=Depends(session)):
- """Tell an agent to take a specific action."""
- asyncio.create_task(session.agent.run_from_step(step))
+ """Tell an autopilot to take a specific action."""
+ asyncio.create_task(session.autopilot.run_from_step(step))
return "Success"
@router.get("/history")
def get_history(session=Depends(session)) -> History:
- return session.agent.history
+ return session.autopilot.history
@router.post("/observation")
def post_observation(observation: Observation, session=Depends(session)):
- asyncio.create_task(session.agent.run_from_observation(observation))
+ asyncio.create_task(session.autopilot.run_from_observation(observation))
return "Success"