summaryrefslogtreecommitdiff
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
commitf82ccddd3bc10093fea497ab15e8c1ae132ce66d (patch)
treee106fb44c7b2b30ce05ca5b6d1803c9c16bf1125
parent23bceb8cbd90a2bb739b2a0d79d5125e9c5e978b (diff)
downloadsncontinue-f82ccddd3bc10093fea497ab15e8c1ae132ce66d.tar.gz
sncontinue-f82ccddd3bc10093fea497ab15e8c1ae132ce66d.tar.bz2
sncontinue-f82ccddd3bc10093fea497ab15e8c1ae132ce66d.zip
agent -> autopilot
-rw-r--r--continuedev/src/continuedev/core/agent.py4
-rw-r--r--continuedev/src/continuedev/core/sdk.py18
-rw-r--r--continuedev/src/continuedev/libs/util/copy_codebase.py16
-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
-rw-r--r--docs/docs/concepts/core.md5
-rw-r--r--docs/docs/concepts/llm.md2
-rw-r--r--docs/sidebars.js31
9 files changed, 61 insertions, 61 deletions
diff --git a/continuedev/src/continuedev/core/agent.py b/continuedev/src/continuedev/core/agent.py
index 29c695af..6e920ab4 100644
--- a/continuedev/src/continuedev/core/agent.py
+++ b/continuedev/src/continuedev/core/agent.py
@@ -14,7 +14,7 @@ from .sdk import ContinueSDK
import asyncio
-class Agent(ContinueBaseModel):
+class Autopilot(ContinueBaseModel):
policy: Policy
ide: AbstractIdeProtocolServer
history: History = History.from_empty()
@@ -116,7 +116,7 @@ class Agent(ContinueBaseModel):
async def run_from_step(self, step: "Step"):
# if self._active:
- # raise RuntimeError("Agent is already running")
+ # raise RuntimeError("Autopilot is already running")
self._active = True
next_step = step
diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py
index ce0c53fd..af7754cc 100644
--- a/continuedev/src/continuedev/core/sdk.py
+++ b/continuedev/src/continuedev/core/sdk.py
@@ -14,7 +14,7 @@ from ..libs.steps.core.core import *
from .env import get_env_var, make_sure_env_exists
-class Agent:
+class Autopilot:
pass
@@ -43,17 +43,17 @@ class ContinueSDK:
ide: AbstractIdeProtocolServer
steps: ContinueSDKSteps
models: Models
- __agent: Agent
+ __autopilot: Autopilot
- def __init__(self, agent: Agent):
- self.ide = agent.ide
- self.__agent = agent
+ def __init__(self, autopilot: Autopilot):
+ self.ide = autopilot.ide
+ self.__autopilot = autopilot
self.steps = ContinueSDKSteps(self)
self.models = Models(self)
@property
def history(self) -> History:
- return self.__agent.history
+ return self.__autopilot.history
async def _ensure_absolute_path(self, path: str) -> str:
if os.path.isabs(path):
@@ -61,13 +61,13 @@ class ContinueSDK:
return os.path.join(await self.ide.getWorkspaceDirectory(), path)
async def run_step(self, step: Step) -> Coroutine[Observation, None, None]:
- return await self.__agent._run_singular_step(step)
+ return await self.__autopilot._run_singular_step(step)
async def apply_filesystem_edit(self, edit: FileSystemEdit):
return await self.run_step(FileSystemEditStep(edit=edit))
async def wait_for_user_input(self) -> str:
- return await self.__agent.wait_for_user_input()
+ return await self.__autopilot.wait_for_user_input()
async def wait_for_user_confirmation(self, prompt: str):
return await self.run_step(WaitForUserConfirmationStep(prompt=prompt))
@@ -136,5 +136,5 @@ class ContinueSDK:
return ContinueConfig()
def set_loading_message(self, message: str):
- # self.__agent.set_loading_message(message)
+ # self.__autopilot.set_loading_message(message)
raise NotImplementedError()
diff --git a/continuedev/src/continuedev/libs/util/copy_codebase.py b/continuedev/src/continuedev/libs/util/copy_codebase.py
index ef1db72b..af957a34 100644
--- a/continuedev/src/continuedev/libs/util/copy_codebase.py
+++ b/continuedev/src/continuedev/libs/util/copy_codebase.py
@@ -5,7 +5,7 @@ from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
from ..models.main import FileEdit, DeleteDirectory, DeleteFile, AddDirectory, AddFile, FileSystemEdit, Position, Range, RenameFile, RenameDirectory, SequentialFileSystemEdit
from ..models.filesystem import FileSystem
-from ..libs.main import Agent
+from ..libs.main import Autopilot
from ..libs.map_path import map_path
from ..libs.steps.main import ManualEditAction
import shutil
@@ -65,15 +65,15 @@ def calculate_diff(filepath: str, original: str, updated: str) -> List[FileEdit]
# The whole usage of watchdog here should only be specific to RealFileSystem, you want to have a different "Observer" class for VirtualFileSystem, which would depend on being sent notifications
class CopyCodebaseEventHandler(PatternMatchingEventHandler):
- def __init__(self, ignore_directories: List[str], ignore_patterns: List[str], agent: Agent, orig_root: str, copy_root: str, filesystem: FileSystem):
+ def __init__(self, ignore_directories: List[str], ignore_patterns: List[str], autopilot: Autopilot, orig_root: str, copy_root: str, filesystem: FileSystem):
super().__init__(ignore_directories=ignore_directories, ignore_patterns=ignore_patterns)
- self.agent = agent
+ self.autopilot = autopilot
self.orig_root = orig_root
self.copy_root = copy_root
self.filesystem = filesystem
- # For now, we'll just make the update immediately, but eventually need to sync with agent.
- # It should be the agent that makes the update right? It's just another action, everything comes from a single stream.
+ # For now, we'll just make the update immediately, but eventually need to sync with autopilot.
+ # It should be the autopilot that makes the update right? It's just another action, everything comes from a single stream.
def _event_to_edit(self, event) -> Union[FileSystemEdit, None]:
# NOTE: You'll need to map paths to create both an action within the copy filesystem (the one you take) and one in the original fileystem (the one you'll record and allow the user to accept). Basically just need a converter built in to the FileSystemEdit class
@@ -110,13 +110,13 @@ class CopyCodebaseEventHandler(PatternMatchingEventHandler):
return
edit = edit.with_mapped_paths(self.orig_root, self.copy_root)
action = ManualEditAction(edit)
- self.agent.act(action)
+ self.autopilot.act(action)
-def maintain_copy_workspace(agent: Agent, filesystem: FileSystem, orig_root: str, copy_root: str):
+def maintain_copy_workspace(autopilot: Autopilot, filesystem: FileSystem, orig_root: str, copy_root: str):
observer = Observer()
event_handler = CopyCodebaseEventHandler(
- [".git"], [], agent, orig_root, copy_root, filesystem)
+ [".git"], [], autopilot, orig_root, copy_root, filesystem)
observer.schedule(event_handler, orig_root, recursive=True)
observer.start()
try:
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):
diff --git a/docs/docs/concepts/core.md b/docs/docs/concepts/core.md
index ee58cbb2..d60f46ac 100644
--- a/docs/docs/concepts/core.md
+++ b/docs/docs/concepts/core.md
@@ -3,11 +3,12 @@
The `Core` connects the SDK and GUI with the IDE (i.e. in VS Code, a web browser, etc), enabling the steps to make changes to your code and accelerate your software development workflows.
The `Core` includes
+
- IDE protocol
- GUI protocol
- SDK
-- Agent
+- Autopilot
There is a two-way sync between an IDE and the GUI that happens through Core.
-**Q: does this make sense as a concept?** \ No newline at end of file
+**Q: does this make sense as a concept?**
diff --git a/docs/docs/concepts/llm.md b/docs/docs/concepts/llm.md
index 11bbacc7..8c2dbcba 100644
--- a/docs/docs/concepts/llm.md
+++ b/docs/docs/concepts/llm.md
@@ -4,4 +4,4 @@
**Q: should we call this LLM? Perhaps just model?**
-**Q: should this abstraction be connected to agent?** \ No newline at end of file
+**Q: should this abstraction be connected to autopilot?**
diff --git a/docs/sidebars.js b/docs/sidebars.js
index db9ae662..29e35a02 100644
--- a/docs/sidebars.js
+++ b/docs/sidebars.js
@@ -13,27 +13,26 @@
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
-
docsSidebar: [
- 'intro',
- 'create-a-recipe',
+ "intro",
+ "create-a-recipe",
{
- type: 'category',
- label: 'Concepts',
+ type: "category",
+ label: "Concepts",
items: [
- 'concepts/agent',
- 'concepts/core',
- 'concepts/gui',
- 'concepts/history',
- 'concepts/ide',
- 'concepts/llm',
- 'concepts/policy',
- 'concepts/recipes',
- 'concepts/sdk',
- 'concepts/step',
+ "concepts/autopilot",
+ "concepts/core",
+ "concepts/gui",
+ "concepts/history",
+ "concepts/ide",
+ "concepts/llm",
+ "concepts/policy",
+ "concepts/recipes",
+ "concepts/sdk",
+ "concepts/step",
],
},
],
};
-module.exports = sidebars; \ No newline at end of file
+module.exports = sidebars;