From 562bcf4bdcdabbb549c0fcb298a66e8d1814fe1c Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Tue, 30 May 2023 17:08:33 +0200 Subject: splitting up nate's brain dump --- docs/docs/concepts/autopilot.md | 4 +++- docs/docs/concepts/ide.md | 3 +++ docs/docs/concepts/policy.md | 4 +++- docs/docs/concepts/sdk.md | 2 ++ docs/docs/concepts/step.md | 2 ++ docs/docs/how-continue-works.md | 52 ++++++++++++++--------------------------- 6 files changed, 30 insertions(+), 37 deletions(-) (limited to 'docs') diff --git a/docs/docs/concepts/autopilot.md b/docs/docs/concepts/autopilot.md index 8d0d3231..c49e221e 100644 --- a/docs/docs/concepts/autopilot.md +++ b/docs/docs/concepts/autopilot.md @@ -4,10 +4,12 @@ ## One sentence definition -The `autopilot` is +The `autopilot` class is the main loop, completing Steps and then deciding the next step and repeating. ## What else to know +An autopilot takes user input from the React app. You can see this happening in `server/notebook.py`. It basically queues user inputs, pops off the most recent, runs that as a "UserInputStep", uses its Policy to run other steps until the next step is None, and then pops off the next user input. When nothing left, just waits for more. + `Autopilot` contains the - History - LLM diff --git a/docs/docs/concepts/ide.md b/docs/docs/concepts/ide.md index b9bb8dbe..85e72dc9 100644 --- a/docs/docs/concepts/ide.md +++ b/docs/docs/concepts/ide.md @@ -16,6 +16,9 @@ The VS Code extension implementation can be found at `/continue/extension/src` ### GitHub Codespaces +- `ide_protocol.py` is just the abstract version of what is implemented in `ide.py`, and `main.py` runs both `notebook.py` and `ide.py` as a single FastAPI server. This is the entry point to the Continue server, and acts as a bridge between IDE and React app +- extension directory contains 1. The VS Code extension, whose code is in `extension/src`, with `extension.ts` being the entry point, and 2. the Continue React app, in the `extension/react-app` folder. This is displayed in the sidebar of VSCode, but is designed to work with any IDE that implements the protocol as is done in `extension/src/continueIdeClient.ts`. + ## IDE Protocol methods ### handle_json diff --git a/docs/docs/concepts/policy.md b/docs/docs/concepts/policy.md index 36d52616..4bd3ed5e 100644 --- a/docs/docs/concepts/policy.md +++ b/docs/docs/concepts/policy.md @@ -2,10 +2,12 @@ ## One sentence definition -A `policy` is +A `policy` is decides what step to run next and is associated with a [autopilot](./autopilot.md). ## What else to know +The Policy is where slash commands are defined. The Policy is a global thing, so probably something we'll want to make user-configurable if we don't significantly change it. + *TODO: Explain in detail what this is and what its purpose is* The policy determines what step to run next diff --git a/docs/docs/concepts/sdk.md b/docs/docs/concepts/sdk.md index 18c6ca79..33b0b74b 100644 --- a/docs/docs/concepts/sdk.md +++ b/docs/docs/concepts/sdk.md @@ -6,6 +6,8 @@ The `Continue SDK` gives you access to tools (e.g. open a directory, edit a file ## What else to know +The ContinueSDK has a `run_step` method, which allows Steps to be composable. The reason you want to run it with `run_step` instead of creating a Step and calling `step.run(...)` is so Continue can automatically keep track of the order of all steps run, and allow for reversibility, etc... The ContinueSDK also contains functions for very common steps, like `edit_file`, `add_file`, `run` (to run shell commands), and a few others. `sdk.history` lets you access the history of past steps. `sdk.llm` lets you use the Autopilot's language model like `sdk.llm.complete`. `sdk.ide` lets you take any action within the connected IDE (this is where the IDE protocol is called). + *TODO: Explain in detail what this is and what its purpose is* *TODO: Detail all the SDK methods and how to use them* diff --git a/docs/docs/concepts/step.md b/docs/docs/concepts/step.md index a32cdc1d..97973a06 100644 --- a/docs/docs/concepts/step.md +++ b/docs/docs/concepts/step.md @@ -8,6 +8,8 @@ A `step` is ## What else to know +A `Step` is a Pydantic class inheriting from `Step`. Steps implement the `run` method, which takes a ContinueSDK as its only parameter. The ContinueSDK gives all the utilities you need to easily write recipes (Steps). It also implements the `describe` method, which just computes a textual description of what happened when the `run` method was called. Can save attributes in `run` if you want, or just have a default `describe`, or not even implement it, in which case the name of the class is used. Any parameters to a Step are defined as attributes to the class without a double leading underscore (those with this are private). + Steps can be composed together ### Step methods diff --git a/docs/docs/how-continue-works.md b/docs/docs/how-continue-works.md index f09c8221..550f328b 100644 --- a/docs/docs/how-continue-works.md +++ b/docs/docs/how-continue-works.md @@ -2,6 +2,8 @@ *TODO: Describe in more detail how `Continue` works* +## Overview + The `Continue` library consists of a [SDK](./concepts/sdk.md), a [GUI](./concepts/gui.md), and a [Core](./concepts/core.md) that brings everything together. The [SDK](./concepts/sdk.md) gives you access to tools (e.g. open a directory, edit a file, call a model, etc), which you can use when defining how a step should work and composing them with other steps. @@ -10,38 +12,18 @@ The [GUI](./concepts/gui.md) enables you to guide steps and makes everything tra The [Core](./concepts/core.md) 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. -### continuedev - -`core` folder contains major concepts, including Agent, Observation (sunsetting this potentially), Policy, SDK (all so far in their own files), and in `main.py`, History, HistoryNode, Step, and others. `env.py` is a common place to load environment variables, which can then be imported from here. - -`libs` contains misc. stuff. `llm` for language model utilities. `steps` for builtin Continue steps. `util` for very misc. stuff. `chroma` for chroma code that deals with codebase embeddings. - -`models` contains all the Pydantic models and `generate_json_schema.py`, a script that converts them to JSONSchema .json files in `schema/json`. - -`plugins` not really used, was from when I was using pluggy. I'll delete. - -`server` runs the servers that communicate with a) the React app (`notebook.py`) and b) the IDE (`ide.py`). `ide_protocol.py` is just the abstract version of what is implemented in `ide.py`, and `main.py` runs both `notebook.py` and `ide.py` as a single FastAPI server. This is the entry point to the Continue server, and acts as a bridge between IDE and React app. - -### docs - -Self-explanatory, but Docusaurus - -### extension - -Contains 1. The VS Code extension, whose code is in `extension/src`, with `extension.ts` being the entry point, and 2. the Continue React app, in the `extension/react-app` folder. This is displayed in the sidebar of VSCode, but is designed to work with any IDE that implements the protocol as is done in `extension/src/continueIdeClient.ts`. - -### schema - -We use OpenAPI/JSONSchema to define types so that it's really easy to bring them across language barriers. Use Pydantic types, then run `poetry run typegen` from the root of continuedev folder to generate JSONSchema json files in the `schema/json` folder. Then `npm run typegen` from the extension folder generates the types that are used within the extension. - ---- - -### GENERAL INFORMATION - -The Continue `Agent` class is the main loop, completing Steps and then deciding the next step and repeating. An Agent has a `Policy`, which decides what step to take next. An Agent takes user input from the React app. You can see this happening in `server/notebook.py`. It basically queues user inputs, pops off the most recent, runs that as a "UserInputStep", uses its Policy to run other steps until the next step is None, and then pops off the next user input. When nothing left, just waits for more. - -The Policy is where slash commands are defined. The Policy is a global thing, so probably something we'll want to make user-configurable if we don't significantly change it. - -A `Step` is a Pydantic class inheriting from `Step`. Steps implement the `run` method, which takes a ContinueSDK as its only parameter. The ContinueSDK gives all the utilities you need to easily write recipes (Steps). It also implements the `describe` method, which just computes a textual description of what happened when the `run` method was called. Can save attributes in `run` if you want, or just have a default `describe`, or not even implement it, in which case the name of the class is used. Any parameters to a Step are defined as attributes to the class without a double leading underscore (those with this are private). - -The ContinueSDK has a `run_step` method, which allows Steps to be composable. The reason you want to run it with `run_step` instead of creating a Step and calling `step.run(...)` is so Continue can automatically keep track of the order of all steps run, and allow for reversibility, etc... The ContinueSDK also contains functions for very common steps, like `edit_file`, `add_file`, `run` (to run shell commands), and a few others. `sdk.history` lets you access the history of past steps. `sdk.llm` lets you use the Agent's language model like `sdk.llm.complete`. `sdk.ide` lets you take any action within the connected IDE (this is where the IDE protocol is called). \ No newline at end of file +## What to know about codebase + +- `core` directory contains major concepts + - This includes Autopilot, Policy, SDK (all in their own files so far) + - It also includes `main.py`, which contains History, HistoryNode, Step, and others + - You'll find `env.py` here too, which is a common place to load environment variables, which can then be imported from here +- `libs` contains misc. stuff +- `llm` for language model utilities +- `steps` for builtin Continue steps +- `util` for very misc. stuff +- `chroma` for chroma code that deals with codebase embeddings +- `models` contains all the Pydantic models and `generate_json_schema.py`, a script that converts them to JSONSchema .json files in `schema/json` +- `server` runs the servers that communicate with a) the React app (`notebook.py`) and b) the IDE (`ide.py`) +- `ide_protocol.py` is just the abstract version of what is implemented in `ide.py`, and `main.py` runs both `notebook.py` and `ide.py` as a single FastAPI server. This is the entry point to the Continue server, and acts as a bridge between IDE and React app +- We use OpenAPI/JSONSchema to define types so that it's really easy to bring them across language barriers. Use Pydantic types, then run `poetry run typegen` from the root of continuedev folder to generate JSONSchema json files in the `schema/json` folder. Then `npm run typegen` from the extension folder generates the types that are used within the extension. \ No newline at end of file -- cgit v1.2.3-70-g09d2