summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yaml130
-rw-r--r--.vscode/launch.json33
-rw-r--r--continuedev/src/continuedev/libs/llm/ggml.py5
-rw-r--r--continuedev/src/continuedev/libs/llm/replicate.py2
-rw-r--r--continuedev/src/continuedev/libs/llm/together.py122
-rw-r--r--continuedev/src/continuedev/plugins/steps/help.py3
-rw-r--r--extension/.vscodeignore4
-rw-r--r--extension/package-lock.json4
-rw-r--r--extension/package.json4
-rw-r--r--extension/react-app/package.json1
-rw-r--r--extension/react-app/src/components/ComboBox.tsx3
-rw-r--r--extension/react-app/src/redux/slices/serverStateReducer.ts6
-rw-r--r--extension/scripts/package.js42
-rw-r--r--extension/src/activation/environmentSetup.ts2
-rw-r--r--extension/src/continueIdeClient.ts13
-rw-r--r--extension/src/test-runner/runTestOnVSCodeHost.ts5
-rw-r--r--extension/src/test-suite/environmentSetup.test.ts17
17 files changed, 334 insertions, 62 deletions
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 03c33dba..94f7073b 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -4,7 +4,6 @@ on:
push:
branches:
- main
- - package-python
jobs:
pyinstaller:
@@ -15,6 +14,8 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
+ # Install Python requirements and build+upload binaries for each platform
+
- name: Check-out repository
uses: actions/checkout@v3
@@ -44,33 +45,46 @@ jobs:
name: ${{ runner.os }} Build
path: dist/*
- publish:
+ test-and-package:
needs: pyinstaller
- runs-on: ubuntu-latest
- permissions:
- contents: write
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-20.04, windows-latest]
+
+ runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
+ # Download corresponding binary artifact for the platform
+
+ - name: Create exe directory
+ run: |
+ mkdir extension/server/exe
+
- name: Download Linux build
uses: actions/download-artifact@v2
with:
name: Linux Build
- path: exe/linux
+ path: extension/server/exe/linux
+ if: matrix.os == 'ubuntu-20.04'
- name: Download macOS build
uses: actions/download-artifact@v2
with:
name: macOS Build
- path: exe/mac
+ path: extension/server/exe/mac
+ if: matrix.os == 'macos-latest'
- name: Download Windows build
uses: actions/download-artifact@v2
with:
name: Windows Build
- path: exe/windows
+ path: extension/server/exe/windows
+ if: matrix.os == 'windows-latest'
+
+ # Setup Node.js and install dependencies
- name: Use Node.js 19.0.0
uses: actions/setup-node@v3
@@ -99,11 +113,83 @@ jobs:
cd extension/react-app
npm ci --legacy-peer-deps
- - name: Build and Publish
+ # Run tests
+
+ - name: Package the extension
run: |
cd extension
npm run package
- npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }}
+
+ - name: Install Xvfb for Linux and run tests
+ run: |
+ sudo apt-get install -y xvfb # Install Xvfb
+ Xvfb :99 & # Start Xvfb
+ export DISPLAY=:99 # Export the display number to the environment
+ cd extension
+ npm run test
+ if: matrix.os == 'ubuntu-20.04'
+
+ - name: Run extension tests
+ run: |
+ cd extension
+ npm run test
+ if: matrix.os != 'ubuntu-20.04'
+
+ # Upload .vsix artifact
+
+ - name: Upload .vsix as an artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: vsix-artifact
+ path: extension/build/*
+ if: matrix.os == 'ubuntu-20.04'
+
+ publish:
+ needs: test-and-package
+ runs-on: ubuntu-20.04
+ permissions:
+ contents: write
+
+ steps:
+ # Checkout and download .vsix artifact
+
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Download .vsix artifact
+ uses: actions/download-artifact@v2
+ with:
+ name: vsix-artifact
+ path: extension/build
+
+ # Publish the extension and commit/push the version change
+
+ - name: Use Node.js 19.0.0
+ uses: actions/setup-node@v3
+ with:
+ node-version: 19.0.0
+
+ - name: Cache extension node_modules
+ uses: actions/cache@v2
+ with:
+ path: extension/node_modules
+ key: ${{ runner.os }}-node-${{ hashFiles('extension/package-lock.json') }}
+
+ - name: Install extension Dependencies
+ run: |
+ cd extension
+ npm ci
+
+ - name: Publish
+ run: |
+ cd extension
+ npx vsce publish -p ${{ secrets.VSCE_TOKEN }} --packagePath ./build/*.vsix
+
+ - name: Update version in package.json
+ run: |
+ cd extension
+ npm version patch
+
- name: Commit changes
run: |
git config --local user.email "action@github.com"
@@ -116,18 +202,32 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- - name: Upload .vsix artifact
- uses: actions/upload-artifact@v2
+ # Download binaries and upload to S3
+
+ - name: Download Linux build
+ uses: actions/download-artifact@v2
with:
- name: vsix-artifact
- path: extension/build/*
+ name: Linux Build
+ path: exe/linux
+
+ - name: Download macOS build
+ uses: actions/download-artifact@v2
+ with:
+ name: macOS Build
+ path: exe/mac
+
+ - name: Download Windows build
+ uses: actions/download-artifact@v2
+ with:
+ name: Windows Build
+ path: exe/windows
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- aws-region: us-west-2
+ aws-region: us-west-1
- name: Upload binaries to S3
uses: jakejarvis/s3-sync-action@master
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 702544fe..12cfaef8 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -7,18 +7,12 @@
{
"name": "Server + Extension (VSCode)",
"stopAll": true,
- "configurations": [
- "Server",
- "Extension (VSCode)"
- ]
+ "configurations": ["Server", "Extension (VSCode)"]
},
{
"name": "Server + Tests (VSCode)",
"stopAll": true,
- "configurations": [
- "Server",
- "Tests (VSCode)"
- ]
+ "configurations": ["Server", "Tests (VSCode)"]
}
],
"configurations": [
@@ -27,12 +21,9 @@
"type": "python",
"request": "launch",
"module": "continuedev.src.continuedev.server.main",
- "args": [
- "--port",
- "8001"
- ],
+ "args": ["--port", "8001"],
"justMyCode": false,
- "subProcess": false,
+ "subProcess": false
// Does it need a build task?
// What about a watch task? - type errors?
},
@@ -45,14 +36,12 @@
// Pass a directory to manually test in
"${workspaceFolder}/extension/manual-testing-sandbox",
"${workspaceFolder}/extension/manual-testing-sandbox/example.ts",
- "--extensionDevelopmentPath=${workspaceFolder}/extension",
- ],
- "outFiles": [
- "${workspaceFolder}/extension/out/**/*.js"
+ "--extensionDevelopmentPath=${workspaceFolder}/extension"
],
+ "outFiles": ["${workspaceFolder}/extension/out/**/*.js"],
"preLaunchTask": "vscode-extension:build",
"env": {
- "CONTINUE_SERVER_URL": "http://localhost:65432"
+ "CONTINUE_SERVER_URL": "http://localhost:8001"
}
},
// Has to be run after starting the server (separately or using the compound configuration)
@@ -77,10 +66,10 @@
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "vscode-extension:tests:build",
"env": {
- "CONTINUE_SERVER_URL": "http://localhost:8001",
+ "CONTINUE_SERVER_URL": "http://localhost:65432",
// Avoid timing out when stopping on breakpoints during debugging in VSCode
- "MOCHA_TIMEOUT": "0",
- },
+ "MOCHA_TIMEOUT": "0"
+ }
}
]
-} \ No newline at end of file
+}
diff --git a/continuedev/src/continuedev/libs/llm/ggml.py b/continuedev/src/continuedev/libs/llm/ggml.py
index 2f131354..25a61e63 100644
--- a/continuedev/src/continuedev/libs/llm/ggml.py
+++ b/continuedev/src/continuedev/libs/llm/ggml.py
@@ -82,7 +82,10 @@ class GGML(LLM):
chunks = json_chunk.split("\n")
for chunk in chunks:
if chunk.strip() != "":
- yield json.loads(chunk[6:])["choices"][0]["delta"]
+ yield {
+ "role": "assistant",
+ "content": json.loads(chunk[6:])["choices"][0]["delta"]
+ }
except:
raise Exception(str(line[0]))
diff --git a/continuedev/src/continuedev/libs/llm/replicate.py b/continuedev/src/continuedev/libs/llm/replicate.py
index 235fd906..0dd359e7 100644
--- a/continuedev/src/continuedev/libs/llm/replicate.py
+++ b/continuedev/src/continuedev/libs/llm/replicate.py
@@ -25,7 +25,7 @@ class ReplicateLLM(LLM):
@property
def default_args(self):
- return {**DEFAULT_ARGS, "model": self.name, "max_tokens": 1024}
+ return {**DEFAULT_ARGS, "model": self.model, "max_tokens": 1024}
def count_tokens(self, text: str):
return count_tokens(self.name, text)
diff --git a/continuedev/src/continuedev/libs/llm/together.py b/continuedev/src/continuedev/libs/llm/together.py
new file mode 100644
index 00000000..c3f171c9
--- /dev/null
+++ b/continuedev/src/continuedev/libs/llm/together.py
@@ -0,0 +1,122 @@
+import json
+from typing import Any, Coroutine, Dict, Generator, List, Union
+
+import aiohttp
+from ...core.main import ChatMessage
+from ..llm import LLM
+from ..util.count_tokens import compile_chat_messages, DEFAULT_ARGS, count_tokens
+
+
+class TogetherLLM(LLM):
+ # this is model-specific
+ api_key: str
+ model: str = "togethercomputer/RedPajama-INCITE-7B-Instruct"
+ max_context_length: int = 2048
+ base_url: str = "https://api.together.xyz"
+ verify_ssl: bool = True
+
+ _client_session: aiohttp.ClientSession = None
+
+ async def start(self, **kwargs):
+ self._client_session = aiohttp.ClientSession(
+ connector=aiohttp.TCPConnector(verify_ssl=self.verify_ssl))
+
+ async def stop(self):
+ await self._client_session.close()
+
+ @property
+ def name(self):
+ return self.model
+
+ @property
+ def context_length(self):
+ return self.max_context_length
+
+ @property
+ def default_args(self):
+ return {**DEFAULT_ARGS, "model": self.model, "max_tokens": 1024}
+
+ def count_tokens(self, text: str):
+ return count_tokens(self.name, text)
+
+ def convert_to_prompt(self, chat_messages: List[ChatMessage]) -> str:
+ system_message = None
+ if chat_messages[0]["role"] == "system":
+ system_message = chat_messages.pop(0)["content"]
+
+ prompt = "\n"
+ if system_message:
+ prompt += f"<human>: Hi!\n<bot>: {system_message}\n"
+ for message in chat_messages:
+ prompt += f'<{"human" if message["role"] == "user" else "bot"}>: {message["content"]}\n'
+
+ prompt += "<bot>:"
+ return prompt
+
+ async def stream_complete(self, prompt, with_history: List[ChatMessage] = None, **kwargs) -> Generator[Union[Any, List, Dict], None, None]:
+ args = self.default_args.copy()
+ args.update(kwargs)
+ args["stream_tokens"] = True
+
+ args = {**self.default_args, **kwargs}
+ messages = compile_chat_messages(
+ self.name, with_history, self.context_length, args["max_tokens"], prompt, functions=args.get("functions", None), system_message=self.system_message)
+
+ async with self._client_session.post(f"{self.base_url}/inference", json={
+ "prompt": self.convert_to_prompt(messages),
+ **args
+ }, headers={
+ "Authorization": f"Bearer {self.api_key}"
+ }) as resp:
+ async for line in resp.content.iter_any():
+ if line:
+ try:
+ yield line.decode("utf-8")
+ except:
+ raise Exception(str(line))
+
+ async def stream_chat(self, messages: List[ChatMessage] = None, **kwargs) -> Generator[Union[Any, List, Dict], None, None]:
+ args = {**self.default_args, **kwargs}
+ messages = compile_chat_messages(
+ self.name, messages, self.context_length, args["max_tokens"], None, functions=args.get("functions", None), system_message=self.system_message)
+ args["stream_tokens"] = True
+
+ async with self._client_session.post(f"{self.base_url}/inference", json={
+ "prompt": self.convert_to_prompt(messages),
+ **args
+ }, headers={
+ "Authorization": f"Bearer {self.api_key}"
+ }) as resp:
+ async for line in resp.content.iter_chunks():
+ if line[1]:
+ try:
+ json_chunk = line[0].decode("utf-8")
+ if json_chunk.startswith(": ping - ") or json_chunk.startswith("data: [DONE]"):
+ continue
+ chunks = json_chunk.split("\n")
+ for chunk in chunks:
+ if chunk.strip() != "":
+ yield {
+ "role": "assistant",
+ "content": json.loads(chunk[6:])["choices"][0]["text"]
+ }
+ except:
+ raise Exception(str(line[0]))
+
+ async def complete(self, prompt: str, with_history: List[ChatMessage] = None, **kwargs) -> Coroutine[Any, Any, str]:
+ args = {**self.default_args, **kwargs}
+
+ messages = compile_chat_messages(args["model"], with_history, self.context_length,
+ args["max_tokens"], prompt, functions=None, system_message=self.system_message)
+ async with self._client_session.post(f"{self.base_url}/inference", json={
+ "prompt": self.convert_to_prompt(messages),
+ **args
+ }, headers={
+ "Authorization": f"Bearer {self.api_key}"
+ }) as resp:
+ try:
+ text = await resp.text()
+ j = json.loads(text)
+ return j["output"]["choices"][0]["text"]
+ except:
+ raise Exception(await resp.text())
diff --git a/continuedev/src/continuedev/plugins/steps/help.py b/continuedev/src/continuedev/plugins/steps/help.py
index ec670999..82f885d6 100644
--- a/continuedev/src/continuedev/plugins/steps/help.py
+++ b/continuedev/src/continuedev/plugins/steps/help.py
@@ -39,6 +39,7 @@ class HelpStep(Step):
if question.strip() == "":
self.description = help
else:
+ self.description = "The following output is generated by a language model, which may hallucinate. Type just '/help'to see a fixed answer. You can also learn more by reading [the docs](https://continue.dev/docs).\n\n"
prompt = dedent(f"""
Information:
@@ -48,7 +49,7 @@ class HelpStep(Step):
Please us the information below to provide a succinct answer to the following question: {question}
- Do not cite any slash commands other than those you've been told about, which are: /edit and /feedback.""")
+ Do not cite any slash commands other than those you've been told about, which are: /edit and /feedback. Never refer or link to any URL.""")
self.chat_context.append(ChatMessage(
role="user",
diff --git a/extension/.vscodeignore b/extension/.vscodeignore
index d3326fdc..51d66585 100644
--- a/extension/.vscodeignore
+++ b/extension/.vscodeignore
@@ -24,4 +24,6 @@ react-app/src
scripts/data
scripts/env
-scripts/.continue_env_installed \ No newline at end of file
+scripts/.continue_env_installed
+
+server/exe/** \ No newline at end of file
diff --git a/extension/package-lock.json b/extension/package-lock.json
index c8b8d183..19d91123 100644
--- a/extension/package-lock.json
+++ b/extension/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "continue",
- "version": "0.0.297",
+ "version": "0.0.299",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "continue",
- "version": "0.0.297",
+ "version": "0.0.299",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",
diff --git a/extension/package.json b/extension/package.json
index 7480e33a..c5fc5b67 100644
--- a/extension/package.json
+++ b/extension/package.json
@@ -1,6 +1,7 @@
{
"name": "continue",
"icon": "media/terminal-continue.png",
+ "version": "0.0.299",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
@@ -14,7 +15,6 @@
"displayName": "Continue",
"pricing": "Free",
"description": "The open-source coding autopilot",
- "version": "0.0.297",
"publisher": "Continue",
"engines": {
"vscode": "^1.67.0"
@@ -194,7 +194,7 @@
"lint": "eslint src --ext ts",
"build-test": "tsc && node esbuild.test.mjs",
"test": "npm run build-test && node ./out/test-runner/runTestOnVSCodeHost.js",
- "package": "npm install && npm run typegen && cd react-app && npm install && npm run build && cd .. && mkdir -p ./build && vsce package --out ./build"
+ "package": "node scripts/package.js"
},
"devDependencies": {
"@nestjs/common": "^8.4.7",
diff --git a/extension/react-app/package.json b/extension/react-app/package.json
index 38beb742..23cdf9bb 100644
--- a/extension/react-app/package.json
+++ b/extension/react-app/package.json
@@ -1,7 +1,6 @@
{
"name": "react-app",
"private": true,
- "version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx
index c75f9ee6..4e564000 100644
--- a/extension/react-app/src/components/ComboBox.tsx
+++ b/extension/react-app/src/components/ComboBox.tsx
@@ -487,7 +487,8 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
selected={downshiftProps.selectedItem === item}
>
<span>
- {item.name}:{" "}
+ {item.name}
+ {" "}
<span style={{ color: lightGray }}>{item.description}</span>
</span>
</Li>
diff --git a/extension/react-app/src/redux/slices/serverStateReducer.ts b/extension/react-app/src/redux/slices/serverStateReducer.ts
index bd60f1c7..a20476b2 100644
--- a/extension/react-app/src/redux/slices/serverStateReducer.ts
+++ b/extension/react-app/src/redux/slices/serverStateReducer.ts
@@ -9,9 +9,9 @@ const initialState: FullState = {
name: "Welcome to Continue",
hide: false,
description: `- Highlight code section and ask a question or give instructions
- - Use \`cmd+m\` (Mac) / \`ctrl+m\` (Windows) to open Continue
- - Use \`/help\` to ask questions about how to use Continue
- - [Customize Continue](https://continue.dev/docs/customization) (e.g. use your own API key) by typing '/config'.`,
+- Use \`cmd+m\` (Mac) / \`ctrl+m\` (Windows) to open Continue
+- Use \`/help\` to ask questions about how to use Continue
+- [Customize Continue](https://continue.dev/docs/customization) (e.g. use your own API key) by typing '/config'.`,
system_message: null,
chat_context: [],
manage_own_chat_context: false,
diff --git a/extension/scripts/package.js b/extension/scripts/package.js
new file mode 100644
index 00000000..59da9181
--- /dev/null
+++ b/extension/scripts/package.js
@@ -0,0 +1,42 @@
+const { exec } = require("child_process");
+const fs = require("fs");
+const path = require("path");
+
+exec("npm install", (error) => {
+ if (error) throw error;
+ console.log("npm install completed");
+
+ exec("npm run typegen", (error) => {
+ if (error) throw error;
+ console.log("npm run typegen completed");
+
+ process.chdir("react-app");
+
+ exec("npm install", (error) => {
+ if (error) throw error;
+ console.log("npm install in react-app completed");
+
+ exec("npm run build", (error) => {
+ if (error) throw error;
+ if (!fs.existsSync(path.join("dist", "assets", "index.js"))) {
+ throw new Error("react-app build did not produce index.js");
+ }
+ if (!fs.existsSync(path.join("dist", "assets", "index.css"))) {
+ throw new Error("react-app build did not produce index.css");
+ }
+ console.log("npm run build in react-app completed");
+
+ process.chdir("..");
+
+ if (!fs.existsSync("build")) {
+ fs.mkdirSync("build");
+ }
+
+ exec("vsce package --out ./build patch", (error) => {
+ if (error) throw error;
+ console.log("vsce package completed");
+ });
+ });
+ });
+ });
+});
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts
index f0e41ca9..748a5984 100644
--- a/extension/src/activation/environmentSetup.ts
+++ b/extension/src/activation/environmentSetup.ts
@@ -240,7 +240,7 @@ export async function startContinuePythonServer() {
windowsHide: true,
});
child.stdout.on("data", (data: any) => {
- console.log(`stdout: ${data}`);
+ // console.log(`stdout: ${data}`);
});
child.stderr.on("data", (data: any) => {
console.log(`stderr: ${data}`);
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index d89093ca..5b9e285d 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -12,7 +12,7 @@ import {
rejectSuggestionCommand,
} from "./suggestions";
import { FileEditWithFullContents } from "../schema/FileEditWithFullContents";
-import * as fs from 'fs';
+import * as fs from "fs";
import { WebsocketMessenger } from "./util/messenger";
import { diffManager } from "./diffs";
const os = require("os");
@@ -30,13 +30,12 @@ class IdeProtocolClient {
private _lastReloadTime: number = 16;
private _reconnectionTimeouts: NodeJS.Timeout[] = [];
- private _sessionId: string | null = null;
+ sessionId: string | null = null;
private _serverUrl: string;
private _newWebsocketMessenger() {
const requestUrl =
- this._serverUrl +
- (this._sessionId ? `?session_id=${this._sessionId}` : "");
+ this._serverUrl + (this.sessionId ? `?session_id=${this.sessionId}` : "");
const messenger = new WebsocketMessenger(requestUrl);
this.messenger = messenger;
@@ -383,7 +382,9 @@ class IdeProtocolClient {
async getUserSecret(key: string) {
// Check if secret already exists in VS Code settings (global)
let secret = vscode.workspace.getConfiguration("continue").get(key);
- if (typeof secret !== "undefined" && secret !== null) {return secret;}
+ if (typeof secret !== "undefined" && secret !== null) {
+ return secret;
+ }
// If not, ask user for secret
secret = await vscode.window.showInputBox({
@@ -420,7 +421,7 @@ class IdeProtocolClient {
console.log("Getting session ID");
const resp = await this.messenger?.sendAndReceive("getSessionId", {});
console.log("New Continue session with ID: ", resp.sessionId);
- this._sessionId = resp.sessionId;
+ this.sessionId = resp.sessionId;
return resp.sessionId;
}
diff --git a/extension/src/test-runner/runTestOnVSCodeHost.ts b/extension/src/test-runner/runTestOnVSCodeHost.ts
index 2a542ffc..21267c2d 100644
--- a/extension/src/test-runner/runTestOnVSCodeHost.ts
+++ b/extension/src/test-runner/runTestOnVSCodeHost.ts
@@ -11,7 +11,10 @@ async function main() {
// The path to test runner
// Passed to --extensionTestsPath
- const extensionTestsPath = path.resolve(extensionDevelopmentPath, "out/test-runner/mochaRunner");
+ const extensionTestsPath = path.resolve(
+ extensionDevelopmentPath,
+ "out/test-runner/mochaRunner"
+ );
// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
diff --git a/extension/src/test-suite/environmentSetup.test.ts b/extension/src/test-suite/environmentSetup.test.ts
index 9a478522..d0406340 100644
--- a/extension/src/test-suite/environmentSetup.test.ts
+++ b/extension/src/test-suite/environmentSetup.test.ts
@@ -2,18 +2,27 @@ import { test, describe } from "mocha";
import * as assert from "assert";
import { getContinueServerUrl } from "../bridge";
-import { startContinuePythonServer } from "../activation/environmentSetup";
+import { ideProtocolClient } from "../activation/activate";
import fetch from "node-fetch";
+import fkill from "fkill";
describe("Can start python server", () => {
test("Can start python server in under 10 seconds", async function () {
- this.timeout(17_000);
- await startContinuePythonServer();
+ const allowedTime = 25_000;
+ this.timeout(allowedTime + 10_000);
+ try {
+ fkill(65432, { force: true, silent: true });
+ console.log("Killed existing server");
+ } catch (e) {
+ console.log("No existing server: ", e);
+ }
- await new Promise((resolve) => setTimeout(resolve, 15_000));
+ // If successful, the server is started by the extension while we wait
+ await new Promise((resolve) => setTimeout(resolve, allowedTime));
// Check if server is running
const serverUrl = getContinueServerUrl();
+ console.log("Server URL: ", serverUrl);
const response = await fetch(`${serverUrl}/health`);
assert.equal(response.status, 200);
});