From 88b56763a3fe831230d4d172c97ff95a1f3d3ba8 Mon Sep 17 00:00:00 2001 From: mkummer225 <7843299+mkummer225@users.noreply.github.com> Date: Tue, 13 Aug 2024 16:46:37 -0600 Subject: [PATCH 001/104] initial TTS functionality --- core/config/profile/doLoadConfig.ts | 4 ++ core/core.ts | 6 ++ core/index.d.ts | 5 ++ core/util/tts.ts | 108 ++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 core/util/tts.ts diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 16f72d40e..7537fedd6 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -10,6 +10,7 @@ import { import ContinueProxyEmbeddingsProvider from "../../indexing/embeddings/ContinueProxyEmbeddingsProvider.js"; import ContinueProxy from "../../llm/llms/stubs/ContinueProxy.js"; import { Telemetry } from "../../util/posthog.js"; +import { TTS } from "../../util/tts.js"; import { loadFullConfigNode } from "../load.js"; export default async function doLoadConfig( @@ -51,6 +52,9 @@ export default async function doLoadConfig( ideInfo.extensionVersion, ); + // TODO: pass config to pre-load non-system TTS models + await TTS.setup(); + if (newConfig.analytics) { await TeamAnalytics.setup( newConfig.analytics as any, // TODO: Need to get rid of index.d.ts once and for all diff --git a/core/core.ts b/core/core.ts index 340008cdb..bba55631f 100644 --- a/core/core.ts +++ b/core/core.ts @@ -26,6 +26,7 @@ import historyManager from "./util/history"; import type { IMessenger, Message } from "./util/messenger"; import { editConfigJson } from "./util/paths"; import { Telemetry } from "./util/posthog"; +import { TTS } from "./util/tts"; import { streamDiffLines } from "./util/verticalEdit"; export class Core { @@ -383,6 +384,11 @@ export class Core { next = await gen.next(); } + const config = await configHandler.loadConfig(); + if(config.experimental?.readResponseTTS && "completion" in next.value) { + TTS.read(next.value?.completion); + } + return { done: true, content: next.value }; } diff --git a/core/index.d.ts b/core/index.d.ts index 3fcb08fa1..a23068516 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -887,6 +887,11 @@ interface ExperimentalConfig { * function and class declarations. */ quickActions?: QuickActionConfig[]; + + /** + * Automatically read LLM chat responses aloud using system TTS models + */ + readResponseTTS?: boolean; } interface AnalyticsConfig { diff --git a/core/util/tts.ts b/core/util/tts.ts new file mode 100644 index 000000000..77e4b1b12 --- /dev/null +++ b/core/util/tts.ts @@ -0,0 +1,108 @@ +import os from "node:os"; +import { exec, ChildProcess } from "child_process"; + +// The amount of time before a process is declared +// a zombie after executing .kill() +const ttsKillTimeout: number = 5000; + +/** + * Removes code blocks from a message. + * + * Return modified message text. + */ +function removeCodeBlocks(msgText: string): string { + const codeBlockRegex = /```[\s\S]*?```/g; + + // Remove code blocks from the message text + const textWithoutCodeBlocks = msgText.replace(codeBlockRegex, ""); + + return textWithoutCodeBlocks.trim(); +} + +/** + * Cleans a message text to safely be used in 'exec' context on host. + * + * Return modified message text. + */ +function sanitizeMessageForTTS(message: string): string { + message = removeCodeBlocks(message); + + // Remove or replace problematic characters + message = message + .replace(/"/g, "") + .replace(/`/g, "") + .replace(/\$/g, "") + .replace(/\\/g, "") + .replace(/[&|;()<>]/g, ""); + + message = message.trim().replace(/\s+/g, " "); + + return message; +} + +export class TTS { + static os: string | undefined = undefined; + static handle: ChildProcess | undefined = undefined; + + static async read(message: string) { + message = sanitizeMessageForTTS(message); + + try { + // Kill any active TTS processes + await TTS.kill(); + } catch (e) { + console.warn("Error killing TTS process: ", e); + return; + } + + switch (TTS.os) { + case "darwin": + TTS.handle = exec(`say "${message}"`); + break; + case "win32": + // Replace single quotes on windows + TTS.handle = exec( + `powershell -Command "Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('${message.replace( + /'/g, + "''", + )}')"`, + ); + break; + case "linux": + TTS.handle = exec(`espeak "${message}"`); + break; + default: + console.log( + "Text-to-speech is not supported on this operating system.", + ); + break; + } + } + + static async kill(): Promise { + return new Promise((resolve, reject) => { + // Only kill a TTS process if it's still running + if (TTS.handle && TTS.handle.exitCode === null) { + // Use a timeout in case of zombie processes + let killTimeout: NodeJS.Timeout = setTimeout(() => { + reject(`Unable to kill TTS process: ${TTS.handle?.pid}`); + }, ttsKillTimeout); + + // Resolve our promise once the program has exited + TTS.handle.once("exit", () => { + clearTimeout(killTimeout); + TTS.handle = undefined; + resolve(); + }); + + TTS.handle.kill(); + } else { + resolve(); + } + }); + } + + static async setup() { + TTS.os = os.platform(); + } +} From 058784f84a484f6c13873a55e49924442a9df92f Mon Sep 17 00:00:00 2001 From: mkummer225 <7843299+mkummer225@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:52:57 -0600 Subject: [PATCH 002/104] add GUI stop TTS button functionality & stop TTS on new chat --- core/core.ts | 15 ++++++++++++++- core/protocol/core.ts | 1 + core/protocol/ideWebview.ts | 2 ++ core/protocol/passThrough.ts | 3 +++ core/protocol/webview.ts | 2 ++ core/util/tts.ts | 11 ++++++++++- gui/src/hooks/useSetup.ts | 10 ++++++++++ gui/src/pages/gui.tsx | 11 +++++++++++ gui/src/redux/slices/stateSlice.ts | 10 ++++++++++ 9 files changed, 63 insertions(+), 2 deletions(-) diff --git a/core/core.ts b/core/core.ts index bba55631f..16dbd0f06 100644 --- a/core/core.ts +++ b/core/core.ts @@ -360,6 +360,13 @@ export class Core { abortedMessageIds: Set, msg: Message, ) { + const config = await configHandler.loadConfig(); + + // Stop TTS on new StreamChat + if(config.experimental?.readResponseTTS) { + TTS.kill(); + } + const model = await configHandler.llmFromTitle(msg.data.title); const gen = model.streamChat( msg.data.messages, @@ -384,7 +391,6 @@ export class Core { next = await gen.next(); } - const config = await configHandler.loadConfig(); if(config.experimental?.readResponseTTS && "completion" in next.value) { TTS.read(next.value?.completion); } @@ -463,6 +469,13 @@ export class Core { } }); + // Provide messenger to TTS so it can set GUI active / inactive state + TTS.messenger = this.messenger; + + on("tts/kill", async () => { + TTS.kill(); + }); + async function* runNodeJsSlashCommand( configHandler: ConfigHandler, abortedMessageIds: Set, diff --git a/core/protocol/core.ts b/core/protocol/core.ts index fb3f7c684..1476fe67e 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -129,6 +129,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { undefined, { model: string; promptTokens: number; generatedTokens: number }[], ]; + "tts/kill": [undefined, void]; "index/setPaused": [boolean, void]; "index/forceReIndex": [ undefined | { dir?: string; shouldClearIndexes?: boolean }, diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index 2fa70bf73..d8701a035 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -31,6 +31,8 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & { setInactive: [undefined, void]; + setTTSActive: [undefined, void]; + setTTSInactive: [undefined, void]; submitMessage: [{ message: any }, void]; // any -> JSONContent from TipTap updateSubmenuItems: [ { provider: string; submenuItems: ContextSubmenuItem[] }, diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 5fe14573a..3cfaa7628 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -30,6 +30,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "autocomplete/cancel", "autocomplete/accept", "command/run", + "tts/kill", "llm/complete", "llm/streamComplete", "llm/streamChat", @@ -57,4 +58,6 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] = "refreshSubmenuItems", "isContinueInputFocused", "didChangeAvailableProfiles", + "setTTSActive", + "setTTSInactive", ]; diff --git a/core/protocol/webview.ts b/core/protocol/webview.ts index 061f2819d..5ee751dec 100644 --- a/core/protocol/webview.ts +++ b/core/protocol/webview.ts @@ -13,4 +13,6 @@ export type ToWebviewFromIdeOrCoreProtocol = { }, void, ]; + setTTSInactive: [undefined, void]; + setTTSActive: [undefined, void]; }; diff --git a/core/util/tts.ts b/core/util/tts.ts index 77e4b1b12..62f69f600 100644 --- a/core/util/tts.ts +++ b/core/util/tts.ts @@ -1,5 +1,7 @@ import os from "node:os"; import { exec, ChildProcess } from "child_process"; +import type { IMessenger } from "./messenger"; +import type { FromCoreProtocol, ToCoreProtocol } from "../protocol"; // The amount of time before a process is declared // a zombie after executing .kill() @@ -43,6 +45,7 @@ function sanitizeMessageForTTS(message: string): string { export class TTS { static os: string | undefined = undefined; static handle: ChildProcess | undefined = undefined; + static messenger: IMessenger; static async read(message: string) { message = sanitizeMessageForTTS(message); @@ -75,8 +78,14 @@ export class TTS { console.log( "Text-to-speech is not supported on this operating system.", ); - break; + return; } + + TTS.messenger.request("setTTSActive", undefined); + + TTS.handle?.once("exit", () => { + TTS.messenger.request("setTTSInactive", undefined); + }); } static async kill(): Promise { diff --git a/gui/src/hooks/useSetup.ts b/gui/src/hooks/useSetup.ts index 28cd4019b..e6d05771b 100644 --- a/gui/src/hooks/useSetup.ts +++ b/gui/src/hooks/useSetup.ts @@ -7,6 +7,8 @@ import { setVscMachineId } from "../redux/slices/configSlice"; import { addContextItemsAtIndex, setConfig, + setTTSActive, + setTTSInactive, setInactive, setSelectedProfileId, } from "../redux/slices/stateSlice"; @@ -81,6 +83,14 @@ function useSetup(dispatch: Dispatch) { dispatch(setInactive()); }); + useWebviewListener("setTTSActive", async () => { + dispatch(setTTSActive()); + }); + + useWebviewListener("setTTSInactive", async () => { + dispatch(setTTSInactive()); + }); + useWebviewListener("setColors", async (colors) => { Object.keys(colors).forEach((key) => { document.body.style.setProperty(key, colors[key]); diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index caaff7ea6..faeeccd83 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -195,6 +195,7 @@ function GUI() { const defaultModel = useSelector(defaultModelSelector); + const ttsActive = useSelector((state: RootState) => state.state.ttsActive); const active = useSelector((state: RootState) => state.state.active); const [stepsOpen, setStepsOpen] = useState<(boolean | undefined)[]>([]); @@ -549,6 +550,16 @@ function GUI() { trackVisibility={active} /> + {ttsActive && ( + { + ideMessenger.post("tts/kill", undefined); + }} + > + ■ Stop TTS + + )} {active && ( (values: &mut[T]) { type State = { history: ChatHistory; contextItems: ContextItemWithId[]; + ttsActive: boolean; active: boolean; config: BrowserSerializedContinueConfig; title: string; @@ -110,6 +111,7 @@ type State = { const initialState: State = { history: [], contextItems: [], + ttsActive: false, active: false, config: { slashCommands: [ @@ -168,6 +170,9 @@ export const stateSlice = createSlice({ ? lastHistory.promptLogs.concat(payload) : payload; }, + setTTSActive: (state) => { + state.ttsActive = true; + }, setActive: (state) => { state.active = true; }, @@ -329,6 +334,9 @@ export const stateSlice = createSlice({ } historyItem.contextItems.push(...payload.contextItems); }, + setTTSInactive: (state) => { + state.ttsActive = false; + }, setInactive: (state) => { state.active = false; }, @@ -500,6 +508,7 @@ export const { setContextItemsAtIndex, addContextItems, addContextItemsAtIndex, + setTTSInactive, setInactive, streamUpdate, newSession, @@ -510,6 +519,7 @@ export const { setDefaultModel, setConfig, addPromptCompletionPair, + setTTSActive, setActive, setEditingContextItemAtIndex, initNewActiveMessage, From b5fbb9827890af4d03133baeb63fa3730683099f Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Wed, 14 Aug 2024 17:48:30 -0700 Subject: [PATCH 003/104] add(llm)-bedrock-imported-models --- binary/package-lock.json | 1 + core/index.d.ts | 9 +- core/llm/llms/Bedrock.ts | 11 ++- core/llm/llms/BedrockImport.ts | 94 +++++++++++++++++++ core/llm/llms/index.ts | 2 + docs/static/schemas/config.json | 2 + .../src/main/resources/config_schema.json | 2 + extensions/vscode/config_schema.json | 2 + extensions/vscode/continue_rc_schema.json | 2 + extensions/vscode/package-lock.json | 4 +- extensions/vscode/package.json | 2 +- 11 files changed, 123 insertions(+), 8 deletions(-) create mode 100644 core/llm/llms/BedrockImport.ts diff --git a/binary/package-lock.json b/binary/package-lock.json index 9378d2eef..b57800a29 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -79,6 +79,7 @@ "ollama": "^0.4.6", "onnxruntime-node": "1.14.0", "openai": "^4.20.1", + "p-limit": "^6.1.0", "pg": "^8.11.3", "posthog-node": "^3.6.3", "quick-lru": "^7.0.0", diff --git a/core/index.d.ts b/core/index.d.ts index 3fcb08fa1..42bc389ed 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -341,8 +341,14 @@ export interface LLMOptions { apiVersion?: string; apiType?: string; - // GCP Options + // AWS options + profile?: string; + modelArn?: string; + + // AWS and GCP Options region?: string; + + // GCP Options projectId?: string; capabilities?: ModelCapability; @@ -595,6 +601,7 @@ type ModelProvider = | "gemini" | "mistral" | "bedrock" + | "bedrockimport" | "sagemaker" | "deepinfra" | "flowise" diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index 226671c52..0cdebc309 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -14,19 +14,22 @@ import { stripImages } from "../images.js"; import { BaseLLM } from "../index.js"; class Bedrock extends BaseLLM { - private static PROFILE_NAME: string = "bedrock"; static providerName: ModelProvider = "bedrock"; static defaultOptions: Partial = { region: "us-east-1", model: "anthropic.claude-3-sonnet-20240229-v1:0", - contextLength: 200_000, + contextLength: 200_000 }; + profile?: string | undefined; constructor(options: LLMOptions) { super(options); if (!options.apiBase) { this.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; } + if (options.profile) { + this.profile = options.profile; + } } protected async *_streamComplete( @@ -124,11 +127,11 @@ class Bedrock extends BaseLLM { private async _getCredentials() { try { return await fromIni({ - profile: Bedrock.PROFILE_NAME, + profile: this.profile, })(); } catch (e) { console.warn( - `AWS profile with name ${Bedrock.PROFILE_NAME} not found in ~/.aws/credentials, using default profile`, + `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, ); return await fromIni()(); } diff --git a/core/llm/llms/BedrockImport.ts b/core/llm/llms/BedrockImport.ts new file mode 100644 index 000000000..504f472f2 --- /dev/null +++ b/core/llm/llms/BedrockImport.ts @@ -0,0 +1,94 @@ +import { + BedrockRuntimeClient, + InvokeModelWithResponseStreamCommand, +} from "@aws-sdk/client-bedrock-runtime"; +import { fromIni } from "@aws-sdk/credential-providers"; +import { + CompletionOptions, + LLMOptions, + ModelProvider, +} from "../../index.js"; +import { BaseLLM } from "../index.js"; + +class BedrockImport extends BaseLLM { + static providerName: ModelProvider = "bedrockimport"; + static defaultOptions: Partial = { + region: "us-east-1" + }; + // the BedRock imported custom model ARN + modelArn?: string | undefined; + profile?: string | undefined; + + constructor(options: LLMOptions) { + super(options); + if (!options.apiBase) { + this.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; + } + if (options.modelArn) { + this.modelArn = options.modelArn; + } + if (options.profile) { + this.profile = options.profile; + } + } + + protected async *_streamComplete( + prompt: string, + options: CompletionOptions, + ): AsyncGenerator { + const credentials = await this._getCredentials(); + const client = new BedrockRuntimeClient({ + region: this.region, + credentials: { + accessKeyId: credentials.accessKeyId, + secretAccessKey: credentials.secretAccessKey, + sessionToken: credentials.sessionToken || "", + }, + }); + + const input = this._generateInvokeModelCommandInput(prompt, options); + const command = new InvokeModelWithResponseStreamCommand(input); + const response = await client.send(command); + + if (response.body) { + for await (const item of response.body) { + const chunk = JSON.parse(new TextDecoder().decode(item.chunk?.bytes)); + if (chunk.outputs[0].text) { + yield chunk.outputs[0].text; + } + } + } + } + + private _generateInvokeModelCommandInput( + prompt: string, + options: CompletionOptions, + ): any { + const payload = { + prompt: prompt + }; + + return { + body: JSON.stringify(payload), + modelId: this.modelArn, + accept: "application/json", + contentType: "application/json" + }; + } + + private async _getCredentials() { + try { + return await + fromIni({ + profile: this.profile + })(); + } catch (e) { + console.warn( + `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, + ); + return await fromIni()(); + } + } +} + +export default BedrockImport; diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index cd084207e..7cc6f701f 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -11,6 +11,7 @@ import { BaseLLM } from "../index"; import Anthropic from "./Anthropic"; import Azure from "./Azure"; import Bedrock from "./Bedrock"; +import BedrockImport from "./BedrockImport"; import Cloudflare from "./Cloudflare"; import Cohere from "./Cohere"; import DeepInfra from "./DeepInfra"; @@ -53,6 +54,7 @@ const LLMs = [ LMStudio, Mistral, Bedrock, + BedrockImport, SageMaker, DeepInfra, Flowise, diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 44a908810..4e85e91a4 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -171,6 +171,7 @@ "anthropic", "cohere", "bedrock", + "bedrockimport", "sagemaker", "together", "ollama", @@ -197,6 +198,7 @@ "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/anthropicllm)", "### Cohere\nTo use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/cohere)", "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 44a908810..4e85e91a4 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -171,6 +171,7 @@ "anthropic", "cohere", "bedrock", + "bedrockimport", "sagemaker", "together", "ollama", @@ -197,6 +198,7 @@ "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/anthropicllm)", "### Cohere\nTo use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/cohere)", "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 44a908810..4e85e91a4 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -171,6 +171,7 @@ "anthropic", "cohere", "bedrock", + "bedrockimport", "sagemaker", "together", "ollama", @@ -197,6 +198,7 @@ "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/anthropicllm)", "### Cohere\nTo use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/cohere)", "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index d6c797596..35fc4906f 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -174,6 +174,7 @@ "anthropic", "cohere", "bedrock", + "bedrockimport", "sagemaker", "together", "ollama", @@ -200,6 +201,7 @@ "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/anthropicllm)", "### Cohere\nTo use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/cohere)", "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 6af742e21..7c2cad527 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.197", + "version": "0.9.199", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.197", + "version": "0.9.199", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 389c6bac5..a87c6ac3c 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.197", + "version": "0.9.199", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 48353e651de2a7a8df9cce77473f25e2b79807b1 Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Wed, 14 Aug 2024 17:58:38 -0700 Subject: [PATCH 004/104] update docs --- .../docs/reference/Model Providers/bedrock.md | 11 ++++---- .../Model Providers/bedrockimport.md | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 docs/docs/reference/Model Providers/bedrockimport.md diff --git a/docs/docs/reference/Model Providers/bedrock.md b/docs/docs/reference/Model Providers/bedrock.md index daac562af..d720de66f 100644 --- a/docs/docs/reference/Model Providers/bedrock.md +++ b/docs/docs/reference/Model Providers/bedrock.md @@ -1,4 +1,4 @@ -# AWS Bedrock +# AWS Bedrock To setup Bedrock, add the following to your `config.json` file: @@ -9,18 +9,19 @@ To setup Bedrock, add the following to your `config.json` file: "title": "Bedrock: Claude 3 Sonnet", "provider": "bedrock", "model": "anthropic.claude-3-sonnet-20240229-v1:0", - "region": "us-east-1" + "region": "us-east-1", + "profile": "bedrock", } ] } ``` -Authentication will be through temporary or long-term credentials in -~/.aws/credentials under a profile called "bedrock". +Authentication will be through temporary or long-term credentials in +~/.aws/credentials under a configured profile (e.g. "bedrock"). ```title="~/.aws/credentials [bedrock] aws_access_key_id = abcdefg aws_secret_access_key = hijklmno -aws_session_token = pqrstuvwxyz # Optional: means short term creds. +aws_session_token = pqrstuvwxyz # Optional: means short term creds. ``` diff --git a/docs/docs/reference/Model Providers/bedrockimport.md b/docs/docs/reference/Model Providers/bedrockimport.md new file mode 100644 index 000000000..6a8c50d68 --- /dev/null +++ b/docs/docs/reference/Model Providers/bedrockimport.md @@ -0,0 +1,28 @@ +# AWS Bedrock Custom Imported Models + +To setup Bedrock using custom imported models, add the following to your `config.json` file: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "AWS Bedrock deepseek-coder-6.7b-instruct", + "provider": "bedrockimport", + "model": "deepseek-coder-6.7b-instruct", + "modelArn": "arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX", + "region": "us-west-2", + "profile": "bedrock" + } + ] +} +``` + +Authentication will be through temporary or long-term credentials in +~/.aws/credentials under a configured profile (e.g. "bedrock"). + +```title="~/.aws/credentials +[bedrock] +aws_access_key_id = abcdefg +aws_secret_access_key = hijklmno +aws_session_token = pqrstuvwxyz # Optional: means short term creds. +``` From c20b0b42204afbcc74c1ba779a06f551db885156 Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Thu, 15 Aug 2024 08:15:18 -0700 Subject: [PATCH 005/104] default to bedrock profile for backwards compatibility --- core/llm/llms/Bedrock.ts | 2 ++ core/llm/llms/BedrockImport.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index 0cdebc309..415ec0f10 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -29,6 +29,8 @@ class Bedrock extends BaseLLM { } if (options.profile) { this.profile = options.profile; + } else { + this.profile = "bedrock"; } } diff --git a/core/llm/llms/BedrockImport.ts b/core/llm/llms/BedrockImport.ts index 504f472f2..f53d4b15e 100644 --- a/core/llm/llms/BedrockImport.ts +++ b/core/llm/llms/BedrockImport.ts @@ -29,6 +29,8 @@ class BedrockImport extends BaseLLM { } if (options.profile) { this.profile = options.profile; + } else { + this.profile = "bedrock"; } } From 5008f1d71a4ae2abcf9ae8d2b8e56d5f65a3ea8e Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 11:59:00 -0700 Subject: [PATCH 006/104] draft update jetbrains-release --- .github/workflows/jetbrains-build.yaml | 2 +- .github/workflows/jetbrains-release.yaml | 401 ++++++++++++++++++++--- 2 files changed, 352 insertions(+), 51 deletions(-) diff --git a/.github/workflows/jetbrains-build.yaml b/.github/workflows/jetbrains-build.yaml index 16d07163c..b23094106 100644 --- a/.github/workflows/jetbrains-build.yaml +++ b/.github/workflows/jetbrains-build.yaml @@ -110,7 +110,7 @@ jobs: npm ci # npm install binary - - name: Install core node_modules + - name: Install binary node_modules run: | cd ../../binary npm ci diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 3df1ae29f..85fdece4d 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -3,14 +3,22 @@ # See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information. name: Release -# on: -# release: -# types: [prereleased, released] + +on: + create: + tags: + - "v0.0.*-jetbrains" + branches: + - dev defaults: run: working-directory: ./extensions/intellij +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: check_release_name: runs-on: ubuntu-latest @@ -41,6 +49,10 @@ jobs: with: ref: ${{ github.event.release.tag_name }} + # Validate wrapper + - name: Gradle Wrapper Validation + uses: gradle/actions/wrapper-validation@v3 + # Set up Java environment for the next steps - name: Setup Java uses: actions/setup-java@v4 @@ -59,15 +71,20 @@ jobs: id: properties shell: bash run: | - CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d' - ${{ github.event.release.body }} - EOM - )" + PROPERTIES="$(./gradlew properties --console=plain -q)" + VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" + # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" + CHANGELOG="" + + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT echo "changelog<> $GITHUB_OUTPUT echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier + # Setup Node.js - name: Use Node.js from .nvmrc uses: actions/setup-node@v4 @@ -100,7 +117,7 @@ jobs: npm ci # npm install binary - - name: Install core node_modules + - name: Install binary node_modules run: | cd ../../binary npm ci @@ -123,60 +140,344 @@ jobs: cd ../../extensions/vscode npm ci npm run prepackage + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} # Build binaries - - name: Install core node_modules + - name: Build the binaries run: | cd ../../binary npm run build - # Update Unreleased section with the current release note - - name: Patch Changelog - if: ${{ steps.properties.outputs.changelog != '' }} - env: - CHANGELOG: ${{ steps.properties.outputs.changelog }} + # Build plugin + - name: Build plugin + run: ./gradlew buildPlugin + + # Prepare plugin archive content for creating artifact + - name: Prepare Plugin Artifact + id: artifact + shell: bash run: | - ./gradlew patchChangelog --release-note="$CHANGELOG" + cd ../../extensions/intellij/build/distributions + FILENAME=`ls *.zip` + unzip "$FILENAME" -d content - # Upload artifact as a release asset - - name: Upload Release Asset - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* + echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT - # Publish the plugin to JetBrains Marketplace - - name: Publish Plugin - env: - PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} - CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} - PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} - PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} - run: ./gradlew publishPlugin + # Store already-built plugin as an artifact for downloading + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.artifact.outputs.filename }} + path: ./extensions/intellij/build/distributions/content/*/* - # Create a pull request - - name: Create Pull Request - if: ${{ steps.properties.outputs.changelog != '' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Upload binaries as artifacts + - name: Upload artifact (darwin-arm64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-darwin-arm64 + path: ./binary/bin/darwin-arm64/ + + - name: Upload artifact (darwin-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-darwin-x64 + path: ./binary/bin/darwin-x64/ + + - name: Upload artifact (win32-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-win32-x64 + path: ./binary/bin/win32-x64/ + + - name: Upload artifact (linux-arm64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-linux-arm64 + path: ./binary/bin/linux-arm64/ + + - name: Upload artifact (linux-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-linux-x64 + path: ./binary/bin/linux-x64/ + + test-binaries: + needs: build + strategy: + matrix: + include: + - os: windows-latest + platform: win32 + arch: x64 + npm_config_arch: x64 + - os: ubuntu-latest + platform: linux + arch: x64 + npm_config_arch: x64 + # arm64 not actually supported by GitHub + # - os: ubuntu-latest + # platform: linux + # arch: arm64 + # npm_config_arch: arm64 + - os: macos-12 + platform: darwin + arch: x64 + npm_config_arch: x64 + - os: macos-latest + platform: darwin + arch: arm64 + npm_config_arch: arm64 + runs-on: ${{ matrix.os }} + steps: + # 1. Check-out repository + - name: Check-out repository + uses: actions/checkout@v4 + + # 2. Install npm dependencies + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Cache core node_modules + uses: actions/cache@v3 + with: + path: core/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} + + - name: Cache binary node_modules + uses: actions/cache@v3 + with: + path: binary/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} + + - name: Install Core Dependencies run: | - VERSION="${{ github.event.release.tag_name }}" - BRANCH="changelog-update-$VERSION" - LABEL="release changelog" + cd ../../core + npm ci - git config user.email "action@github.com" - git config user.name "GitHub Action" + - name: Install Binary Dependencies + run: | + cd ../../binary + npm ci - git checkout -b $BRANCH - git commit -am "Changelog update - $VERSION" - git push --set-upstream origin $BRANCH + # Download the binary artifact + - name: Download binary artifact + uses: actions/download-artifact@v4 + with: + name: continue-binary-${{ matrix.platform }}-${{ matrix.arch }} + path: ./binary/bin/${{ matrix.platform }}-${{ matrix.arch }}/ - gh label create "$LABEL" \ - --description "Pull requests with release changelog update" \ - --force \ - || true + # Set execute permissions for the binary (non-Windows) + - name: Set execute permissions + run: | + cd ../../binary/bin/${{ matrix.platform }}-${{ matrix.arch }} + chmod +x continue-binary + chmod +x node_sqlite3.node + chmod +x index.node + chmod +x esbuild + if: ${{ matrix.platform }} != 'win32' - gh pr create \ - --title "Changelog update - \`$VERSION\`" \ - --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ - --label "$LABEL" \ - --head $BRANCH + - name: Copy node_sqlite3.node to necessary location + run: | + cd ../../binary + mkdir build + cp ./bin/${{ matrix.platform }}-${{ matrix.arch }}/node_sqlite3.node ./build/node_sqlite3.node + + # Run tests for binary + - name: Run binary tests + run: | + cd ../../binary + npm run test + + - name: Upload logs + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} + path: binary/.continue/logs/core.log + + # Run tests and upload a code coverage report + test: + name: Test + needs: [build] + runs-on: ubuntu-latest + steps: + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + + # Run tests + - name: Run Tests + run: ./gradlew check + + # Collect Tests Result of failed tests + - name: Collect Tests Result + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: tests-result + path: ${{ github.workspace }}/extensions/intellij/build/reports/tests + + # Upload the Kover report to CodeCov + # - name: Upload Code Coverage Report + # uses: codecov/codecov-action@v4 + # with: + # files: ${{ github.workspace }}/build/reports/kover/report.xml + + # Run Qodana inspections and provide report + inspectCode: + if: false + name: Inspect code + needs: [build] + runs-on: ubuntu-latest + permissions: + contents: write + checks: write + pull-requests: write + steps: + # Free GitHub Actions Environment Disk Space + - name: Maximize Build Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + large-packages: false + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Run Qodana inspections + - name: Qodana - Code Inspection + uses: JetBrains/qodana-action@v2024.1.5 + with: + cache-default-branch-only: true + + # Run plugin structure verification along with IntelliJ Plugin Verifier + verify: + name: Verify plugin + needs: [build] + runs-on: ubuntu-latest + steps: + # Free GitHub Actions Environment Disk Space + - name: Maximize Build Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + large-packages: false + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + + # Cache Plugin Verifier IDEs + - name: Setup Plugin Verifier IDEs Cache + uses: actions/cache@v4 + with: + path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides + key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} + + # Run Verify Plugin task and IntelliJ Plugin Verifier tool + - name: Run Plugin Verification tasks + run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} + + # Collect Plugin Verifier Result + - name: Collect Plugin Verifier Result + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: pluginVerifier-result + path: ${{ github.workspace }}/build/reports/pluginVerifier + + upload-release: + # # Update Unreleased section with the current release note + # - name: Patch Changelog + # if: ${{ steps.properties.outputs.changelog != '' }} + # env: + # CHANGELOG: ${{ steps.properties.outputs.changelog }} + # run: | + # ./gradlew patchChangelog --release-note="$CHANGELOG" + + - name: Download the plugin + uses: actions/download-artifact@v4 + with: + name: ${{ steps.artifact.outputs.filename }} + path: ./build/distributions/ + + # Upload artifact as a release asset + - name: Upload Release Asset + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* + + # Publish the plugin to JetBrains Marketplace + - name: Publish Plugin + env: + PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} + CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} + run: ./gradlew publishPlugin + + # Create a pull request + - name: Create Pull Request + if: ${{ steps.properties.outputs.changelog != '' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${{ github.event.release.tag_name }}" + BRANCH="changelog-update-$VERSION" + LABEL="release changelog" + + git config user.email "action@github.com" + git config user.name "GitHub Action" + + git checkout -b $BRANCH + git commit -am "Changelog update - $VERSION" + git push --set-upstream origin $BRANCH + + gh label create "$LABEL" \ + --description "Pull requests with release changelog update" \ + --force \ + || true + + gh pr create \ + --title "Changelog update - \`$VERSION\`" \ + --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ + --label "$LABEL" \ + --head $BRANCH From 1c437a74de7558c2e645e3d5b3139166056163b0 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 11:59:19 -0700 Subject: [PATCH 007/104] update branch name --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 85fdece4d..285d0bae8 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -9,7 +9,7 @@ on: tags: - "v0.0.*-jetbrains" branches: - - dev + - nate/apple-developer-finally defaults: run: From 111c03f1da039b5741763a95f1f7ddcae4ddaca9 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 12:02:54 -0700 Subject: [PATCH 008/104] fix syntax --- .github/workflows/jetbrains-release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 285d0bae8..577b266b2 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -435,9 +435,9 @@ jobs: - name: Download the plugin uses: actions/download-artifact@v4 - with: - name: ${{ steps.artifact.outputs.filename }} - path: ./build/distributions/ + with: + name: ${{ steps.artifact.outputs.filename }} + path: ./build/distributions/ # Upload artifact as a release asset - name: Upload Release Asset From dc11b1e9987573f31c33360cb7ac9afd348fa5e9 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 12:03:11 -0700 Subject: [PATCH 009/104] trigger on push for testing --- .github/workflows/jetbrains-release.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 577b266b2..4c5454a7f 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -5,9 +5,10 @@ name: Release on: - create: - tags: - - "v0.0.*-jetbrains" + push: + # create: + # tags: + # - "v0.0.*-jetbrains" branches: - nate/apple-developer-finally From a273fe804c0a1b1539a9253990f31db1008718ea Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 12:03:58 -0700 Subject: [PATCH 010/104] syntax --- .github/workflows/jetbrains-release.yaml | 97 ++++++++++++------------ 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 4c5454a7f..d7228bf9d 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -426,59 +426,60 @@ jobs: path: ${{ github.workspace }}/build/reports/pluginVerifier upload-release: - # # Update Unreleased section with the current release note - # - name: Patch Changelog - # if: ${{ steps.properties.outputs.changelog != '' }} - # env: - # CHANGELOG: ${{ steps.properties.outputs.changelog }} - # run: | - # ./gradlew patchChangelog --release-note="$CHANGELOG" + steps: + # # Update Unreleased section with the current release note + # - name: Patch Changelog + # if: ${{ steps.properties.outputs.changelog != '' }} + # env: + # CHANGELOG: ${{ steps.properties.outputs.changelog }} + # run: | + # ./gradlew patchChangelog --release-note="$CHANGELOG" - - name: Download the plugin - uses: actions/download-artifact@v4 - with: - name: ${{ steps.artifact.outputs.filename }} - path: ./build/distributions/ + - name: Download the plugin + uses: actions/download-artifact@v4 + with: + name: ${{ steps.artifact.outputs.filename }} + path: ./build/distributions/ - # Upload artifact as a release asset - - name: Upload Release Asset - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* + # Upload artifact as a release asset + - name: Upload Release Asset + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* - # Publish the plugin to JetBrains Marketplace - - name: Publish Plugin - env: - PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} - CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} - PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} - PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} - run: ./gradlew publishPlugin + # Publish the plugin to JetBrains Marketplace + - name: Publish Plugin + env: + PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} + CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} + run: ./gradlew publishPlugin - # Create a pull request - - name: Create Pull Request - if: ${{ steps.properties.outputs.changelog != '' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION="${{ github.event.release.tag_name }}" - BRANCH="changelog-update-$VERSION" - LABEL="release changelog" + # Create a pull request + - name: Create Pull Request + if: ${{ steps.properties.outputs.changelog != '' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${{ github.event.release.tag_name }}" + BRANCH="changelog-update-$VERSION" + LABEL="release changelog" - git config user.email "action@github.com" - git config user.name "GitHub Action" + git config user.email "action@github.com" + git config user.name "GitHub Action" - git checkout -b $BRANCH - git commit -am "Changelog update - $VERSION" - git push --set-upstream origin $BRANCH + git checkout -b $BRANCH + git commit -am "Changelog update - $VERSION" + git push --set-upstream origin $BRANCH - gh label create "$LABEL" \ - --description "Pull requests with release changelog update" \ - --force \ - || true + gh label create "$LABEL" \ + --description "Pull requests with release changelog update" \ + --force \ + || true - gh pr create \ - --title "Changelog update - \`$VERSION\`" \ - --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ - --label "$LABEL" \ - --head $BRANCH + gh pr create \ + --title "Changelog update - \`$VERSION\`" \ + --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ + --label "$LABEL" \ + --head $BRANCH From c9f21c88e47036ca297ba1a257e4aa3f6068fbbd Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 12:04:17 -0700 Subject: [PATCH 011/104] on tag --- .github/workflows/jetbrains-release.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index d7228bf9d..32e45d3be 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -5,10 +5,9 @@ name: Release on: - push: - # create: - # tags: - # - "v0.0.*-jetbrains" + create: + tags: + - "v0.0.*-jetbrains" branches: - nate/apple-developer-finally From 4ea218d854dd73809fa77cf6b161def11587efa0 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 12:04:57 -0700 Subject: [PATCH 012/104] delete jetbrains-build --- .github/workflows/jetbrains-build.yaml | 476 ------------------------- 1 file changed, 476 deletions(-) delete mode 100644 .github/workflows/jetbrains-build.yaml diff --git a/.github/workflows/jetbrains-build.yaml b/.github/workflows/jetbrains-build.yaml deleted file mode 100644 index b23094106..000000000 --- a/.github/workflows/jetbrains-build.yaml +++ /dev/null @@ -1,476 +0,0 @@ -# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps: -# - Validate Gradle Wrapper. -# - Run 'test' and 'verifyPlugin' tasks. -# - Run Qodana inspections. -# - Run the 'buildPlugin' task and prepare artifact for further tests. -# - Run the 'runPluginVerifier' task. -# - Create a draft release. -# -# The workflow is triggered on push and pull_request events. -# -# GitHub Actions reference: https://help.github.com/en/actions -# -## JBIJPPTPL - -name: Build -# on: -# # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests) -# push: -# branches: [main, preview] -# Trigger the workflow on any pull request -# pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -defaults: - run: - working-directory: ./extensions/intellij - -jobs: - # Prepare environment and build the plugin - build: - name: Build - runs-on: macos-latest - outputs: - version: ${{ steps.properties.outputs.version }} - changelog: ${{ steps.properties.outputs.changelog }} - pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} - steps: - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Validate wrapper - - name: Gradle Wrapper Validation - uses: gradle/actions/wrapper-validation@v3 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # Set environment variables - - name: Export Properties - id: properties - shell: bash - run: | - PROPERTIES="$(./gradlew properties --console=plain -q)" - VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" - # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" - CHANGELOG="" - - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT - - echo "changelog<> $GITHUB_OUTPUT - echo "$CHANGELOG" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier - - # Setup Node.js - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - # Cache node_modules - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache binary node_modules - uses: actions/cache@v3 - with: - path: binary/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} - - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - # npm install core - - name: Install core node_modules - run: | - cd ../../core - npm ci - - # npm install binary - - name: Install binary node_modules - run: | - cd ../../binary - npm ci - - # npm install gui - - name: Install gui node_modules - run: | - cd ../../gui - npm ci - - # build gui - - name: Build gui - run: | - cd ../../gui - npm run build - - # Run prepackage.js script - - name: Run prepackage script - run: | - cd ../../extensions/vscode - npm ci - npm run prepackage - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - # Build binaries - - name: Build the binaries - run: | - cd ../../binary - npm run build - - # Build plugin - - name: Build plugin - run: ./gradlew buildPlugin - - # Prepare plugin archive content for creating artifact - - name: Prepare Plugin Artifact - id: artifact - shell: bash - run: | - cd ../../extensions/intellij/build/distributions - FILENAME=`ls *.zip` - unzip "$FILENAME" -d content - - echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT - - # Store already-built plugin as an artifact for downloading - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.artifact.outputs.filename }} - path: ./extensions/intellij/build/distributions/content/*/* - - # Upload binaries as artifacts - - name: Upload artifact (darwin-arm64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-darwin-arm64 - path: ./binary/bin/darwin-arm64/ - - - name: Upload artifact (darwin-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-darwin-x64 - path: ./binary/bin/darwin-x64/ - - - name: Upload artifact (win32-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-win32-x64 - path: ./binary/bin/win32-x64/ - - - name: Upload artifact (linux-arm64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-linux-arm64 - path: ./binary/bin/linux-arm64/ - - - name: Upload artifact (linux-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-linux-x64 - path: ./binary/bin/linux-x64/ - - test-binaries: - needs: build - strategy: - matrix: - include: - - os: windows-latest - platform: win32 - arch: x64 - npm_config_arch: x64 - - os: ubuntu-latest - platform: linux - arch: x64 - npm_config_arch: x64 - # arm64 not actually supported by GitHub - # - os: ubuntu-latest - # platform: linux - # arch: arm64 - # npm_config_arch: arm64 - - os: macos-12 - platform: darwin - arch: x64 - npm_config_arch: x64 - - os: macos-latest - platform: darwin - arch: arm64 - npm_config_arch: arm64 - runs-on: ${{ matrix.os }} - steps: - # 1. Check-out repository - - name: Check-out repository - uses: actions/checkout@v4 - - # 2. Install npm dependencies - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache binary node_modules - uses: actions/cache@v3 - with: - path: binary/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} - - - name: Install Core Dependencies - run: | - cd ../../core - npm ci - - - name: Install Binary Dependencies - run: | - cd ../../binary - npm ci - - # Download the binary artifact - - name: Download binary artifact - uses: actions/download-artifact@v4 - with: - name: continue-binary-${{ matrix.platform }}-${{ matrix.arch }} - path: ./binary/bin/${{ matrix.platform }}-${{ matrix.arch }}/ - - # Set execute permissions for the binary (non-Windows) - - name: Set execute permissions - run: | - cd ../../binary/bin/${{ matrix.platform }}-${{ matrix.arch }} - chmod +x continue-binary - chmod +x node_sqlite3.node - chmod +x index.node - chmod +x esbuild - if: ${{ matrix.platform }} != 'win32' - - - name: Copy node_sqlite3.node to necessary location - run: | - cd ../../binary - mkdir build - cp ./bin/${{ matrix.platform }}-${{ matrix.arch }}/node_sqlite3.node ./build/node_sqlite3.node - - # Run tests for binary - - name: Run binary tests - run: | - cd ../../binary - npm run test - - - name: Upload logs - if: ${{ always() }} - uses: actions/upload-artifact@v2 - with: - name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} - path: binary/.continue/logs/core.log - - # Run tests and upload a code coverage report - test: - name: Test - needs: [build] - runs-on: ubuntu-latest - steps: - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # Run tests - - name: Run Tests - run: ./gradlew check - - # Collect Tests Result of failed tests - - name: Collect Tests Result - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: tests-result - path: ${{ github.workspace }}/extensions/intellij/build/reports/tests - - # Upload the Kover report to CodeCov - # - name: Upload Code Coverage Report - # uses: codecov/codecov-action@v4 - # with: - # files: ${{ github.workspace }}/build/reports/kover/report.xml - - # Run Qodana inspections and provide report - inspectCode: - if: false - name: Inspect code - needs: [build] - runs-on: ubuntu-latest - permissions: - contents: write - checks: write - pull-requests: write - steps: - # Free GitHub Actions Environment Disk Space - - name: Maximize Build Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - large-packages: false - - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Run Qodana inspections - - name: Qodana - Code Inspection - uses: JetBrains/qodana-action@v2024.1.5 - with: - cache-default-branch-only: true - - # Run plugin structure verification along with IntelliJ Plugin Verifier - verify: - name: Verify plugin - needs: [build] - runs-on: ubuntu-latest - steps: - # Free GitHub Actions Environment Disk Space - - name: Maximize Build Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - large-packages: false - - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # Cache Plugin Verifier IDEs - - name: Setup Plugin Verifier IDEs Cache - uses: actions/cache@v4 - with: - path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides - key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} - - # Run Verify Plugin task and IntelliJ Plugin Verifier tool - - name: Run Plugin Verification tasks - run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} - - # Collect Plugin Verifier Result - - name: Collect Plugin Verifier Result - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: pluginVerifier-result - path: ${{ github.workspace }}/build/reports/pluginVerifier - - # Prepare a draft release for GitHub Releases page for the manual verification - # If accepted and published, release workflow would be triggered - releaseDraft: - name: Release draft - if: github.event_name != 'pull_request' - needs: [build, test, test-binaries, verify] - runs-on: ubuntu-latest - permissions: - contents: write - steps: - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - - name: Set up Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Tag the repository - id: tag - run: | - # See https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names - TAG=v${{ needs.build.outputs.version }}-jetbrains - echo "$TAG" - echo "tag=$TAG" >> $GITHUB_OUTPUT - git tag -a $TAG -m "Published version $TAG" ${GITHUB_SHA} - git push origin $TAG - - # Remove old release drafts by using the curl request for the available releases with a draft flag - - name: Remove Old Release Drafts - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh api repos/{owner}/{repo}/releases \ - --jq '.[] | select(.draft == true) | .id' \ - | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} - - # Create a new release draft which is not publicly visible and requires manual acceptance - - name: Create Release Draft - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create "${{ steps.tag.outputs.tag }}" \ - --draft \ - --title "v${{ needs.build.outputs.version }}-jetbrains" \ - --notes "$(cat << 'EOM' - ${{ needs.build.outputs.changelog }} - EOM - )" - - # Download the Gradle build artifact - - name: Download Gradle build artifact - uses: actions/download-artifact@v4 - with: - name: ${{ needs.build.outputs.filename }} - path: ./artifacts From 11f6c9b18d4908c026153db15b93597827a797f5 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 12:07:07 -0700 Subject: [PATCH 013/104] set runs-on --- .github/workflows/jetbrains-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 32e45d3be..578de0786 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -425,6 +425,7 @@ jobs: path: ${{ github.workspace }}/build/reports/pluginVerifier upload-release: + runs-on: ubuntu-latest steps: # # Update Unreleased section with the current release note # - name: Patch Changelog From 26cc5342301933c39608b0128c5bd38cfb4c31e9 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 12:09:01 -0700 Subject: [PATCH 014/104] release -> build --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 578de0786..439c624fd 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -34,7 +34,7 @@ jobs: fi # Prepare and publish the plugin to JetBrains Marketplace repository - release: + build: needs: check_release_name if: needs.check_release_name.outputs.should_run == 'true' name: Publish Plugin From 6e966488b270a19c0a28f2f485c1ac0363492b26 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 12:23:13 -0700 Subject: [PATCH 015/104] update triggers --- .github/workflows/jetbrains-release.yaml | 9 ++++----- .github/workflows/main.yaml | 2 +- .github/workflows/preview.yaml | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 439c624fd..955de0d44 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -5,16 +5,15 @@ name: Release on: - create: - tags: - - "v0.0.*-jetbrains" - branches: - - nate/apple-developer-finally + release: + types: [prereleased] defaults: run: working-directory: ./extensions/intellij +if: ${{ startsWith(github.event.release.tag_name, 'v') }} + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3591d3e23..74e2cdc25 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,7 +1,7 @@ name: Publish Extension on: - create: + push: tags: - "v0.8.*-vscode" branches: diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index aea470286..40f61c3e3 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -1,7 +1,7 @@ name: Publish Preview Extension on: - create: + push: tags: - "v0.9.*-vscode" branches: From 778e6df85fb889f856624acd06433c179e42dcb5 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 15 Aug 2024 12:30:04 -0700 Subject: [PATCH 016/104] correct if statement --- .github/workflows/jetbrains-release.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 955de0d44..606f328ed 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -12,8 +12,6 @@ defaults: run: working-directory: ./extensions/intellij -if: ${{ startsWith(github.event.release.tag_name, 'v') }} - concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -26,7 +24,7 @@ jobs: steps: - id: check run: | - if [[ "${{ github.event.release.name }}" == *-jetbrains ]]; then + if [[ "${{ github.event.release.tag_name }}" == v0.0.*-jetbrains ]]; then echo "should_run=true" >> $GITHUB_OUTPUT else echo "should_run=false" >> $GITHUB_OUTPUT From e701ceacfa77a8c75f1878770fbdfb428cdf9524 Mon Sep 17 00:00:00 2001 From: mkummer225 <7843299+mkummer225@users.noreply.github.com> Date: Thu, 15 Aug 2024 18:48:18 -0600 Subject: [PATCH 017/104] cleanup --- core/protocol/ideWebview.ts | 3 +-- core/protocol/passThrough.ts | 1 - core/protocol/webview.ts | 3 +-- core/util/tts.ts | 4 ++-- gui/src/hooks/useSetup.ts | 9 ++------- gui/src/redux/slices/stateSlice.ts | 8 ++------ 6 files changed, 8 insertions(+), 20 deletions(-) diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index d8701a035..5e1e74589 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -31,8 +31,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & { setInactive: [undefined, void]; - setTTSActive: [undefined, void]; - setTTSInactive: [undefined, void]; + setTTSActive: [boolean, void]; submitMessage: [{ message: any }, void]; // any -> JSONContent from TipTap updateSubmenuItems: [ { provider: string; submenuItems: ContextSubmenuItem[] }, diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 3cfaa7628..1e2499ca7 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -59,5 +59,4 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] = "isContinueInputFocused", "didChangeAvailableProfiles", "setTTSActive", - "setTTSInactive", ]; diff --git a/core/protocol/webview.ts b/core/protocol/webview.ts index 5ee751dec..d3b127fdc 100644 --- a/core/protocol/webview.ts +++ b/core/protocol/webview.ts @@ -13,6 +13,5 @@ export type ToWebviewFromIdeOrCoreProtocol = { }, void, ]; - setTTSInactive: [undefined, void]; - setTTSActive: [undefined, void]; + setTTSActive: [boolean, void]; }; diff --git a/core/util/tts.ts b/core/util/tts.ts index 62f69f600..248c38518 100644 --- a/core/util/tts.ts +++ b/core/util/tts.ts @@ -81,10 +81,10 @@ export class TTS { return; } - TTS.messenger.request("setTTSActive", undefined); + TTS.messenger.request("setTTSActive", true); TTS.handle?.once("exit", () => { - TTS.messenger.request("setTTSInactive", undefined); + TTS.messenger.request("setTTSActive", false); }); } diff --git a/gui/src/hooks/useSetup.ts b/gui/src/hooks/useSetup.ts index e6d05771b..a3a4dcfc4 100644 --- a/gui/src/hooks/useSetup.ts +++ b/gui/src/hooks/useSetup.ts @@ -8,7 +8,6 @@ import { addContextItemsAtIndex, setConfig, setTTSActive, - setTTSInactive, setInactive, setSelectedProfileId, } from "../redux/slices/stateSlice"; @@ -83,12 +82,8 @@ function useSetup(dispatch: Dispatch) { dispatch(setInactive()); }); - useWebviewListener("setTTSActive", async () => { - dispatch(setTTSActive()); - }); - - useWebviewListener("setTTSInactive", async () => { - dispatch(setTTSInactive()); + useWebviewListener("setTTSActive", async (status) => { + dispatch(setTTSActive(status)); }); useWebviewListener("setColors", async (colors) => { diff --git a/gui/src/redux/slices/stateSlice.ts b/gui/src/redux/slices/stateSlice.ts index de11a237c..7534d9b85 100644 --- a/gui/src/redux/slices/stateSlice.ts +++ b/gui/src/redux/slices/stateSlice.ts @@ -170,8 +170,8 @@ export const stateSlice = createSlice({ ? lastHistory.promptLogs.concat(payload) : payload; }, - setTTSActive: (state) => { - state.ttsActive = true; + setTTSActive: (state, { payload }: PayloadAction) => { + state.ttsActive = payload; }, setActive: (state) => { state.active = true; @@ -334,9 +334,6 @@ export const stateSlice = createSlice({ } historyItem.contextItems.push(...payload.contextItems); }, - setTTSInactive: (state) => { - state.ttsActive = false; - }, setInactive: (state) => { state.active = false; }, @@ -508,7 +505,6 @@ export const { setContextItemsAtIndex, addContextItems, addContextItemsAtIndex, - setTTSInactive, setInactive, streamUpdate, newSession, From f6d100df524873e44e9da5da00c4b6e192a83ffe Mon Sep 17 00:00:00 2001 From: hbernie Date: Thu, 15 Aug 2024 14:06:07 -0700 Subject: [PATCH 018/104] Add Kindo provider --- core/index.d.ts | 1 + core/llm/llms/Kindo.ts | 16 ++++++++ core/llm/llms/index.ts | 2 + docs/docs/reference/Model Providers/kindo.md | 42 ++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 core/llm/llms/Kindo.ts create mode 100644 docs/docs/reference/Model Providers/kindo.md diff --git a/core/index.d.ts b/core/index.d.ts index 8ce83c6f7..51ea0ecb7 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -588,6 +588,7 @@ type ModelProvider = | "ollama" | "huggingface-tgi" | "huggingface-inference-api" + | "kindo" | "llama.cpp" | "replicate" | "text-gen-webui" diff --git a/core/llm/llms/Kindo.ts b/core/llm/llms/Kindo.ts new file mode 100644 index 000000000..855e386de --- /dev/null +++ b/core/llm/llms/Kindo.ts @@ -0,0 +1,16 @@ +import { LLMOptions, ModelProvider } from "../.."; +import OpenAI from "./OpenAI"; + +class Kindo extends OpenAI { + static providerName: ModelProvider = "kindo"; + static defaultOptions: Partial = { + apiBase: "https://llm.kindo.ai/v1", + requestOptions: { + headers: { + "kindo-token-transaction-type": "CONTINUE" + } + } + }; +} + +export default Kindo; \ No newline at end of file diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index cd084207e..33c7d0406 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -22,6 +22,7 @@ import Gemini from "./Gemini"; import Groq from "./Groq"; import HuggingFaceInferenceAPI from "./HuggingFaceInferenceAPI"; import HuggingFaceTGI from "./HuggingFaceTGI"; +import Kindo from "./Kindo"; import LMStudio from "./LMStudio"; import LlamaCpp from "./LlamaCpp"; import Llamafile from "./Llamafile"; @@ -48,6 +49,7 @@ const LLMs = [ Together, HuggingFaceTGI, HuggingFaceInferenceAPI, + Kindo, LlamaCpp, OpenAI, LMStudio, diff --git a/docs/docs/reference/Model Providers/kindo.md b/docs/docs/reference/Model Providers/kindo.md new file mode 100644 index 000000000..442e30b10 --- /dev/null +++ b/docs/docs/reference/Model Providers/kindo.md @@ -0,0 +1,42 @@ +# Kindo +Kindo offers centralized control over your organization's AI operations, ensuring data protection and compliance with internal policies while supporting various commercial and open-source models. To get started, sign up [here](https://app.kindo.ai/), create your API key on the [API keys page](https://app.kindo.ai/settings/api), and choose a model from the list of supported models in the [plugins tab](https://app.kindo.ai/plugins). + +## Config Example + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "Claude 3.5 Sonnet", + "provider": "kindo", + "model": "claude-3-5-sonnet-20240620", + "apiKey": "" + } + ] +} +``` + +## Tab Autocomplete Config Example + +```json title="~/.continue/config.json" +{ + "tabAutocompleteModel": [ + { + "title": "WhiteRabbitNeo", + "provider": "kindo", + "model": "/models/WhiteRabbitNeo-33B-DeepSeekCoder", + "apiKey": "" + }, + { + "title": "DeepSeek", + "provider": "kindo", + "model": "deepseek-ai/deepseek-coder-33b-instruct", + "apiKey": "" + } + ] +} +``` + +## Security + +To update your organization's model access, adjust the controls in [security settings](https://app.kindo.ai/security-settings). \ No newline at end of file From 872915b643bbe289adf743899f8c046dbca2a9f1 Mon Sep 17 00:00:00 2001 From: hbernie Date: Fri, 16 Aug 2024 15:25:08 -0700 Subject: [PATCH 019/104] Add to model-providers --- docs/docs/setup/model-providers.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs/setup/model-providers.md b/docs/docs/setup/model-providers.md index ab774d242..db79d5e33 100644 --- a/docs/docs/setup/model-providers.md +++ b/docs/docs/setup/model-providers.md @@ -63,6 +63,7 @@ You can deploy a model in your [AWS](https://github.com/continuedev/deploy-os-co You can access both open-source and commercial LLMs via: - [OpenRouter](../reference/Model%20Providers/openrouter.md) +- [Kindo](../reference/Model%20Providers/kindo.md) ### Open-source models From 6002dcea55e7cccdf20adef1c73b4e01f8910e91 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 16 Aug 2024 16:51:29 -0700 Subject: [PATCH 020/104] update ci --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 606f328ed..fb4cad979 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -10,7 +10,7 @@ on: defaults: run: - working-directory: ./extensions/intellij + working-directory: extensions/intellij concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} From ac99735d6da71a028e9416edd32eaa9328a4037a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 16 Aug 2024 16:53:18 -0700 Subject: [PATCH 021/104] change working directory --- .github/workflows/jetbrains-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index fb4cad979..dc06f7b85 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -21,6 +21,7 @@ jobs: runs-on: ubuntu-latest outputs: should_run: ${{ steps.check.outputs.should_run }} + working-directory: . steps: - id: check run: | From 80bde596271b0283773538a3ab5097b1ec3a0e23 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 16 Aug 2024 16:54:34 -0700 Subject: [PATCH 022/104] fix --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index dc06f7b85..1d3d96b83 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -21,9 +21,9 @@ jobs: runs-on: ubuntu-latest outputs: should_run: ${{ steps.check.outputs.should_run }} - working-directory: . steps: - id: check + working-directory: . run: | if [[ "${{ github.event.release.tag_name }}" == v0.0.*-jetbrains ]]; then echo "should_run=true" >> $GITHUB_OUTPUT From d3e31412b08377fd3d04291227ff0ce54c509ded Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 16 Aug 2024 17:21:36 -0700 Subject: [PATCH 023/104] update build to include worker files --- .github/workflows/jetbrains-release.yaml | 4 +++- binary/build.js | 8 ++++++++ binary/pkgJson/darwin-arm64/package.json | 5 ++++- binary/pkgJson/darwin-x64/package.json | 5 ++++- binary/pkgJson/linux-arm64/package.json | 5 ++++- binary/pkgJson/linux-x64/package.json | 5 ++++- binary/pkgJson/win32-arm64/package.json | 5 ++++- binary/pkgJson/win32-x64/package.json | 5 ++++- 8 files changed, 35 insertions(+), 7 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 1d3d96b83..03b2255f9 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -35,7 +35,7 @@ jobs: build: needs: check_release_name if: needs.check_release_name.outputs.should_run == 'true' - name: Publish Plugin + name: Build Plugin runs-on: ubuntu-latest permissions: contents: write @@ -423,6 +423,8 @@ jobs: path: ${{ github.workspace }}/build/reports/pluginVerifier upload-release: + name: Upload Release + needs: build, test-binaries, test, inspectCode, verify runs-on: ubuntu-latest steps: # # Update Unreleased section with the current release note diff --git a/binary/build.js b/binary/build.js index d2f01ee35..4d5861295 100644 --- a/binary/build.js +++ b/binary/build.js @@ -302,6 +302,14 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { `${targetDir}/node_sqlite3.node`, ); } + + // Note that this doesn't verify they actually made it into the binary, just that they were in the expected folder before it was built + pathsToVerify.push("out/index.js"); + pathsToVerify.push("out/llamaTokenizerWorkerPool.mjs"); + pathsToVerify.push("out/tiktokenWorkerPool.mjs"); + pathsToVerify.push("out/xhr-sync-worker.js"); + pathsToVerify.push("out/tree-sitter.wasm"); + validateFilesPresent(pathsToVerify); console.log("[info] Done!"); diff --git a/binary/pkgJson/darwin-arm64/package.json b/binary/pkgJson/darwin-arm64/package.json index cc41ae801..ce6f2cace 100644 --- a/binary/pkgJson/darwin-arm64/package.json +++ b/binary/pkgJson/darwin-arm64/package.json @@ -10,7 +10,10 @@ "assets": [ "../../../core/node_modules/sqlite3/**/*", "../../out/tree-sitter.wasm", - "../../out/tree-sitter-wasms/*" + "../../out/tree-sitter-wasms/*", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-macos-arm64" diff --git a/binary/pkgJson/darwin-x64/package.json b/binary/pkgJson/darwin-x64/package.json index 8ccb256e1..178ef6471 100644 --- a/binary/pkgJson/darwin-x64/package.json +++ b/binary/pkgJson/darwin-x64/package.json @@ -10,7 +10,10 @@ "assets": [ "../../../core/node_modules/sqlite3/**/*", "../../out/tree-sitter.wasm", - "../../out/tree-sitter-wasms/*" + "../../out/tree-sitter-wasms/*", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-macos-x64" diff --git a/binary/pkgJson/linux-arm64/package.json b/binary/pkgJson/linux-arm64/package.json index 9fe88da50..4a3b2a42f 100644 --- a/binary/pkgJson/linux-arm64/package.json +++ b/binary/pkgJson/linux-arm64/package.json @@ -10,7 +10,10 @@ "assets": [ "../../../core/node_modules/sqlite3/**/*", "../../out/tree-sitter.wasm", - "../../out/tree-sitter-wasms/*" + "../../out/tree-sitter-wasms/*", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-linux-arm64" diff --git a/binary/pkgJson/linux-x64/package.json b/binary/pkgJson/linux-x64/package.json index 1c875baa0..f62ecede7 100644 --- a/binary/pkgJson/linux-x64/package.json +++ b/binary/pkgJson/linux-x64/package.json @@ -10,7 +10,10 @@ "assets": [ "../../../core/node_modules/sqlite3/**/*", "../../out/tree-sitter.wasm", - "../../out/tree-sitter-wasms/*" + "../../out/tree-sitter-wasms/*", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-linux-x64" diff --git a/binary/pkgJson/win32-arm64/package.json b/binary/pkgJson/win32-arm64/package.json index 3eeb12234..478cf7eb9 100644 --- a/binary/pkgJson/win32-arm64/package.json +++ b/binary/pkgJson/win32-arm64/package.json @@ -13,7 +13,10 @@ "../../out/tree-sitter-wasms/*", "../../node_modules/win-ca/lib/crypt32-ia32.node", "../../node_modules/win-ca/lib/crypt32-x64.node", - "../../node_modules/win-ca/lib/roots.exe" + "../../node_modules/win-ca/lib/roots.exe", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-win-arm64" diff --git a/binary/pkgJson/win32-x64/package.json b/binary/pkgJson/win32-x64/package.json index 2e495524b..c466fc942 100644 --- a/binary/pkgJson/win32-x64/package.json +++ b/binary/pkgJson/win32-x64/package.json @@ -13,7 +13,10 @@ "../../out/tree-sitter-wasms/*", "../../node_modules/win-ca/lib/crypt32-ia32.node", "../../node_modules/win-ca/lib/crypt32-x64.node", - "../../node_modules/win-ca/lib/roots.exe" + "../../node_modules/win-ca/lib/roots.exe", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-win-x64" From 48d30307b824938a28facc3da5c010333bf804e4 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 16 Aug 2024 17:25:06 -0700 Subject: [PATCH 024/104] update ci --- .github/workflows/jetbrains-release.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 03b2255f9..798f0c1e3 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -424,7 +424,12 @@ jobs: upload-release: name: Upload Release - needs: build, test-binaries, test, inspectCode, verify + needs: + - build + - test-binaries + - test + - inspectCode + - verify runs-on: ubuntu-latest steps: # # Update Unreleased section with the current release note From d3ec41e4086f4ae2e91adadaa65b08d3ea83ef5d Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 16 Aug 2024 17:26:00 -0700 Subject: [PATCH 025/104] ci changes --- .github/workflows/jetbrains-release.yaml | 39 +++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 798f0c1e3..086a2e379 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -5,8 +5,11 @@ name: Release on: - release: - types: [prereleased] + push: + branches: + - nate/apple-developer-finally + # release: + # types: [prereleased] defaults: run: @@ -17,23 +20,23 @@ concurrency: cancel-in-progress: true jobs: - check_release_name: - runs-on: ubuntu-latest - outputs: - should_run: ${{ steps.check.outputs.should_run }} - steps: - - id: check - working-directory: . - run: | - if [[ "${{ github.event.release.tag_name }}" == v0.0.*-jetbrains ]]; then - echo "should_run=true" >> $GITHUB_OUTPUT - else - echo "should_run=false" >> $GITHUB_OUTPUT - fi + # check_release_name: + # runs-on: ubuntu-latest + # outputs: + # should_run: ${{ steps.check.outputs.should_run }} + # steps: + # - id: check + # working-directory: . + # run: | + # if [[ "${{ github.event.release.tag_name }}" == v0.0.*-jetbrains ]]; then + # echo "should_run=true" >> $GITHUB_OUTPUT + # else + # echo "should_run=false" >> $GITHUB_OUTPUT + # fi # Prepare and publish the plugin to JetBrains Marketplace repository build: - needs: check_release_name + # needs: check_release_name if: needs.check_release_name.outputs.should_run == 'true' name: Build Plugin runs-on: ubuntu-latest @@ -44,8 +47,8 @@ jobs: # Check out current repository - name: Fetch Sources uses: actions/checkout@v4 - with: - ref: ${{ github.event.release.tag_name }} + # with: + # ref: ${{ github.event.release.tag_name }} # Validate wrapper - name: Gradle Wrapper Validation From cca2af87b597a3fbd8f5ac7addf25fa9ea25cd64 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 16 Aug 2024 17:28:41 -0700 Subject: [PATCH 026/104] update --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 086a2e379..85b444b97 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -37,7 +37,7 @@ jobs: # Prepare and publish the plugin to JetBrains Marketplace repository build: # needs: check_release_name - if: needs.check_release_name.outputs.should_run == 'true' + # if: needs.check_release_name.outputs.should_run == 'true' name: Build Plugin runs-on: ubuntu-latest permissions: From 567fbb38991ac1173ed4fb859bd528ae6aaec0cc Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 16 Aug 2024 21:58:32 -0700 Subject: [PATCH 027/104] code sign --- .github/workflows/jetbrains-release.yaml | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 85b444b97..50ebbc2e2 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -151,6 +151,32 @@ jobs: cd ../../binary npm run build + - name: Sign darwin-arm64 binary + uses: lando/code-sign-action@v2 + with: + file: ./binary/bin/darwin-arm64/continue-binary + certificate-data: ${{ secrets.APPLE_CERT_DATA }} + certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} + apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} + apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} + apple-notary-tool: altool + apple-team-id: 43XFLY66ZD + apple-product-id: dev.continue.continue-binary + options: --options runtime --entitlements entitlements.xml + + - name: Sign darwin-x64 binary + uses: lando/code-sign-action@v2 + with: + file: ./binary/bin/darwin-x64/continue-binary + certificate-data: ${{ secrets.APPLE_CERT_DATA }} + certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} + apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} + apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} + apple-notary-tool: altool + apple-team-id: 43XFLY66ZD + apple-product-id: dev.continue.continue-binary + options: --options runtime --entitlements entitlements.xml + # Build plugin - name: Build plugin run: ./gradlew buildPlugin From 1546aed5c96f11e504b333608aa51207d6bd40f0 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 17 Aug 2024 09:05:36 -0700 Subject: [PATCH 028/104] run on mac --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 50ebbc2e2..14c496083 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -39,7 +39,7 @@ jobs: # needs: check_release_name # if: needs.check_release_name.outputs.should_run == 'true' name: Build Plugin - runs-on: ubuntu-latest + runs-on: macos-latest permissions: contents: write pull-requests: write From 455534263a9aac29064fdd87cde6d1808e60103c Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 17 Aug 2024 09:57:07 -0700 Subject: [PATCH 029/104] macos-11 --- .github/workflows/jetbrains-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 14c496083..d64f14a87 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -39,7 +39,7 @@ jobs: # needs: check_release_name # if: needs.check_release_name.outputs.should_run == 'true' name: Build Plugin - runs-on: macos-latest + runs-on: macos-11 permissions: contents: write pull-requests: write From f34b06fb83e700a6407374b6017d0a98378f47f3 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 17 Aug 2024 12:31:15 -0700 Subject: [PATCH 030/104] temporary fix for encoding packaging issues --- binary/README.md | 12 ++++++++++++ binary/build.js | 1 + core/llm/asyncEncoder.ts | 14 ++++++++------ core/llm/countTokens.ts | 23 +++++++++++++++++++++-- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/binary/README.md b/binary/README.md index beff54b4b..741cc425f 100644 --- a/binary/README.md +++ b/binary/README.md @@ -30,3 +30,15 @@ The build process is otherwise defined entirely in `build.js`. ## Debugging To debug the binary with IntelliJ, set `useTcp` to `true` in `CoreMessenger.kt`, and then in VS Code run the "Core Binary" debug script. Instead of starting a subprocess for the binary and communicating over stdin/stdout, the IntelliJ extension will connect over TCP to the server started from the VS Code window. You can place breakpoints anywhere in the `core` or `binary` folders. + +## Building + +```bash +npm run build +``` + +## Testing + +```bash +npm run test +``` diff --git a/binary/build.js b/binary/build.js index 4d5861295..1ebc4b196 100644 --- a/binary/build.js +++ b/binary/build.js @@ -162,6 +162,7 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { "../core/vendor/tree-sitter.wasm", "../core/llm/llamaTokenizerWorkerPool.mjs", "../core/llm/llamaTokenizer.mjs", + "../core/llm/tiktokenWorkerPool.mjs", ]; for (const f of filesToCopy) { fs.copyFileSync( diff --git a/core/llm/asyncEncoder.ts b/core/llm/asyncEncoder.ts index ed6425df2..5fd39eed6 100644 --- a/core/llm/asyncEncoder.ts +++ b/core/llm/asyncEncoder.ts @@ -1,7 +1,5 @@ -import llamaTokenizer from "./llamaTokenizer.js"; -import { Tiktoken, encodingForModel as _encodingForModel } from "js-tiktoken"; +import path from "path"; import workerpool from "workerpool"; -import * as path from "path"; export interface AsyncEncoder { encode(text: string): Promise; @@ -13,7 +11,9 @@ export class LlamaAsyncEncoder implements AsyncEncoder { private workerPool: workerpool.Pool; constructor() { - this.workerPool = workerpool.pool(workerCodeFilePath("llamaTokenizerWorkerPool.mjs")); + this.workerPool = workerpool.pool( + workerCodeFilePath("llamaTokenizerWorkerPool.mjs"), + ); } async encode(text: string): Promise { @@ -35,7 +35,9 @@ export class GPTAsyncEncoder implements AsyncEncoder { private workerPool: workerpool.Pool; constructor() { - this.workerPool = workerpool.pool(workerCodeFilePath("tiktokenWorkerPool.mjs")); + this.workerPool = workerpool.pool( + workerCodeFilePath("tiktokenWorkerPool.mjs"), + ); } async encode(text: string): Promise { @@ -58,4 +60,4 @@ function workerCodeFilePath(workerFileName: string): string { return path.join(__dirname, "llm", workerFileName); } return path.join(__dirname, workerFileName); -} \ No newline at end of file +} diff --git a/core/llm/countTokens.ts b/core/llm/countTokens.ts index 5d042e3ca..06cd4a3bb 100644 --- a/core/llm/countTokens.ts +++ b/core/llm/countTokens.ts @@ -24,18 +24,37 @@ class LlamaEncoding implements Encoding { } } +class NonWorkerAsyncEncoder implements AsyncEncoder { + constructor(private readonly encoding: Encoding) {} + + async close(): Promise {} + + async encode(text: string): Promise { + return this.encoding.encode(text); + } + + async decode(tokens: number[]): Promise { + return this.encoding.decode(tokens); + } +} + let gptEncoding: Encoding | null = null; const gptAsyncEncoder = new GPTAsyncEncoder(); const llamaEncoding = new LlamaEncoding(); const llamaAsyncEncoder = new LlamaAsyncEncoder(); function asyncEncoderForModel(modelName: string): AsyncEncoder { + // Temporary due to issues packaging the worker files + if (process.env.IS_BINARY) { + const encoding = encodingForModel(modelName); + return new NonWorkerAsyncEncoder(encoding); + } + const modelType = autodetectTemplateType(modelName); if (!modelType || modelType === "none") { return gptAsyncEncoder; } - // Temporary due to issues packaging the worker files - return process.env.IS_BINARY ? gptAsyncEncoder : llamaAsyncEncoder; + return llamaAsyncEncoder; } function encodingForModel(modelName: string): Encoding { From d28d32c5046f8915da1866cbf1d61153be29bd0a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 17 Aug 2024 19:35:42 -0700 Subject: [PATCH 031/104] try to sign only darwin-x64 --- .github/workflows/jetbrains-release.yaml | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index d64f14a87..26d014dce 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -39,7 +39,7 @@ jobs: # needs: check_release_name # if: needs.check_release_name.outputs.should_run == 'true' name: Build Plugin - runs-on: macos-11 + runs-on: macos-latest permissions: contents: write pull-requests: write @@ -151,18 +151,18 @@ jobs: cd ../../binary npm run build - - name: Sign darwin-arm64 binary - uses: lando/code-sign-action@v2 - with: - file: ./binary/bin/darwin-arm64/continue-binary - certificate-data: ${{ secrets.APPLE_CERT_DATA }} - certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} - apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} - apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} - apple-notary-tool: altool - apple-team-id: 43XFLY66ZD - apple-product-id: dev.continue.continue-binary - options: --options runtime --entitlements entitlements.xml + # - name: Sign darwin-arm64 binary + # uses: lando/code-sign-action@v2 + # with: + # file: ./binary/bin/darwin-arm64/continue-binary + # certificate-data: ${{ secrets.APPLE_CERT_DATA }} + # certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} + # apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} + # apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} + # apple-notary-tool: altool + # apple-team-id: 43XFLY66ZD + # apple-product-id: dev.continue.continue-binary + # options: --options runtime --entitlements entitlements.xml - name: Sign darwin-x64 binary uses: lando/code-sign-action@v2 From 2c0c591f3fb978074c2c047227d5b6202c2778fa Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 09:36:06 -0700 Subject: [PATCH 032/104] codesign --- .github/workflows/jetbrains-release.yaml | 61 +++++++++++++++++++----- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 26d014dce..3bc5ba875 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -50,6 +50,29 @@ jobs: # with: # ref: ${{ github.event.release.tag_name }} + - name: Import Apple certificate + uses: apple-actions/import-codesign-certs@v3 + with: + keychain: ${{ github.run_id }} + keychain-password: ${{ github.run_id }} + p12-file-base64: ${{ secrets.APPLE_CERT_DATA }} + p12-password: ${{ secrets.APPLE_CERT_PASSWORD }} + + # - name: Download artifact + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # OWNER: continuedev + # REPO: continue + # ARTIFACT_ID: 1822461754 + # run: | + # curl -L \ + # -H "Authorization: token $GITHUB_TOKEN" \ + # -H "Accept: application/vnd.github+json" \ + # -o artifact.zip \ + # "https://api.github.com/repos/continuedev/continue/actions/artifacts/1822461754/zip" + # unzip artifact.zip + # shell: bash + # Validate wrapper - name: Gradle Wrapper Validation uses: gradle/actions/wrapper-validation@v3 @@ -151,6 +174,20 @@ jobs: cd ../../binary npm run build + - name: Code sign darwin-arm64 binary + run: | + echo "Signing executable with keychain: ${{ github.run_id }}" + codesign --sign - ../../binary/bin/darwin-x64/continue-binary + codesign --sign - ../../binary/bin/darwin-arm64/continue-binary + + - name: Validate codesigning + run: | + echo "Validating codesigning for darwin-x64 binary" + codesign -dv --verbose=4 ../../binary/bin/darwin-x64/continue-binary + + echo "Validating codesigning for darwin-arm64 binary" + codesign -dv --verbose=4 ../../binary/bin/darwin-arm64/continue-binary + # - name: Sign darwin-arm64 binary # uses: lando/code-sign-action@v2 # with: @@ -164,18 +201,18 @@ jobs: # apple-product-id: dev.continue.continue-binary # options: --options runtime --entitlements entitlements.xml - - name: Sign darwin-x64 binary - uses: lando/code-sign-action@v2 - with: - file: ./binary/bin/darwin-x64/continue-binary - certificate-data: ${{ secrets.APPLE_CERT_DATA }} - certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} - apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} - apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} - apple-notary-tool: altool - apple-team-id: 43XFLY66ZD - apple-product-id: dev.continue.continue-binary - options: --options runtime --entitlements entitlements.xml + # - name: Sign darwin-x64 binary + # uses: lando/code-sign-action@v2 + # with: + # file: ./binary/bin/darwin-x64/continue-binary + # certificate-data: ${{ secrets.APPLE_CERT_DATA }} + # certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} + # apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} + # apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} + # apple-notary-tool: altool + # apple-team-id: 43XFLY66ZD + # apple-product-id: dev.continue.continue-binary + # options: --options runtime --entitlements entitlements.xml # Build plugin - name: Build plugin From 942cd50583521f418c393120cd4bad71135df35c Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 12:55:00 -0700 Subject: [PATCH 033/104] already codesigned --- .github/workflows/jetbrains-release.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 3bc5ba875..5d1cbb918 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -174,11 +174,11 @@ jobs: cd ../../binary npm run build - - name: Code sign darwin-arm64 binary - run: | - echo "Signing executable with keychain: ${{ github.run_id }}" - codesign --sign - ../../binary/bin/darwin-x64/continue-binary - codesign --sign - ../../binary/bin/darwin-arm64/continue-binary + # - name: Code sign darwin binaries + # run: | + # echo "Signing executable with keychain: ${{ github.run_id }}" + # codesign --sign - ../../binary/bin/darwin-x64/continue-binary + # codesign --sign - ../../binary/bin/darwin-arm64/continue-binary - name: Validate codesigning run: | From d5522a989f1636bcacc18087836b452be9f788d1 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 15:03:39 -0700 Subject: [PATCH 034/104] publish to eap and stable --- binary/package-lock.json | 1 + extensions/intellij/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/binary/package-lock.json b/binary/package-lock.json index 9378d2eef..b57800a29 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -79,6 +79,7 @@ "ollama": "^0.4.6", "onnxruntime-node": "1.14.0", "openai": "^4.20.1", + "p-limit": "^6.1.0", "pg": "^8.11.3", "posthog-node": "^3.6.3", "quick-lru": "^7.0.0", diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index e3eba0461..27f108b4a 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -142,6 +142,6 @@ tasks { // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel - channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } + channels = ['eap', 'default'] } } From 5b38fc96dcb17e9dd25d09e93f625ff1bbb3d292 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 15:29:40 -0700 Subject: [PATCH 035/104] change ordering --- .github/workflows/jetbrains-release.yaml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 5d1cbb918..1baa12202 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -140,22 +140,11 @@ jobs: cd ../../core npm ci - # npm install binary - - name: Install binary node_modules - run: | - cd ../../binary - npm ci - # npm install gui - - name: Install gui node_modules + - name: Install gui node_modules and build run: | cd ../../gui npm ci - - # build gui - - name: Build gui - run: | - cd ../../gui npm run build # Run prepackage.js script @@ -168,6 +157,12 @@ jobs: # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + # npm install binary + - name: Install binary node_modules + run: | + cd ../../binary + npm ci + # Build binaries - name: Build the binaries run: | @@ -224,6 +219,9 @@ jobs: shell: bash run: | cd ../../extensions/intellij/build/distributions + echo "Builds:" + ls + echo "---" FILENAME=`ls *.zip` unzip "$FILENAME" -d content From fd69ed69289009842aa002a15aab16f89860b4b6 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 15:33:45 -0700 Subject: [PATCH 036/104] fix build file --- extensions/intellij/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index 27f108b4a..956a3e73e 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -142,6 +142,6 @@ tasks { // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel - channels = ['eap', 'default'] + channels = ["eap", "default"] } } From b675a70eb0d686a20624ba8c0a43e10330cf4d4f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 15:35:00 -0700 Subject: [PATCH 037/104] again --- extensions/intellij/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index 956a3e73e..766cf3ebd 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -142,6 +142,6 @@ tasks { // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel - channels = ["eap", "default"] + channels.set(listOf("eap", "default")) } } From fd9fa36e27aa436a39ee2baf6e6a1b839978f73a Mon Sep 17 00:00:00 2001 From: Cheng Zhu Date: Sun, 18 Aug 2024 17:53:39 -0700 Subject: [PATCH 038/104] added @ open files context provider "pinned" option. --- .../continue/IdeProtocolClient.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt index e8aa27b6c..cead14fbf 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt @@ -31,6 +31,7 @@ import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.TextEditor +import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl import com.intellij.openapi.progress.DumbProgressIndicator import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.DumbAware @@ -44,6 +45,8 @@ import com.intellij.openapi.wm.WindowManager import com.intellij.psi.PsiDocumentManager import com.intellij.testFramework.LightVirtualFile import com.intellij.ui.awt.RelativePoint +import com.intellij.ui.content.ContentManagerUtil +import com.intellij.util.concurrency.annotations.RequiresEdt import kotlinx.coroutines.* import java.awt.Toolkit import java.awt.datatransfer.StringSelection @@ -605,8 +608,10 @@ class IdeProtocolClient ( respond(currentFile) } "getPinnedFiles" -> { - val openFiles = visibleFiles() - respond(openFiles) + ApplicationManager.getApplication().invokeLater { + val pinnedFiles = pinnedFiles() + respond(pinnedFiles) + } } "insertAtCursor" -> { val msg = data as Map; @@ -964,6 +969,14 @@ class IdeProtocolClient ( return fileEditorManager.openFiles.toList().map { it.path } } + @RequiresEdt + private fun pinnedFiles(): List { + val fileEditorManager = FileEditorManager.getInstance(project) as? FileEditorManagerImpl ?: return listOf() + val openFiles = fileEditorManager.openFiles.map { it.path }.toList() + val pinnedFiles = fileEditorManager.windows.flatMap { window -> window.files.filter { window.isFilePinned(it) } }.map { it.path }.toSet() + return openFiles.intersect(pinnedFiles).toList() + } + private fun currentFile(): String? { val fileEditorManager = FileEditorManager.getInstance(project) val editor = fileEditorManager.selectedTextEditor From 1821e1ebb5a2018e556d22dea6ea04a31270772c Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 18:30:58 -0700 Subject: [PATCH 039/104] test --- .github/workflows/jetbrains-release.yaml | 167 +++++++++++------------ 1 file changed, 78 insertions(+), 89 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 1baa12202..9520c4823 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -11,9 +11,9 @@ on: # release: # types: [prereleased] -defaults: - run: - working-directory: extensions/intellij +# defaults: +# run: +# working-directory: extensions/intellij concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -58,62 +58,47 @@ jobs: p12-file-base64: ${{ secrets.APPLE_CERT_DATA }} p12-password: ${{ secrets.APPLE_CERT_PASSWORD }} - # - name: Download artifact - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # OWNER: continuedev - # REPO: continue - # ARTIFACT_ID: 1822461754 - # run: | - # curl -L \ - # -H "Authorization: token $GITHUB_TOKEN" \ - # -H "Accept: application/vnd.github+json" \ - # -o artifact.zip \ - # "https://api.github.com/repos/continuedev/continue/actions/artifacts/1822461754/zip" - # unzip artifact.zip - # shell: bash - # Validate wrapper - - name: Gradle Wrapper Validation - uses: gradle/actions/wrapper-validation@v3 + # - name: Gradle Wrapper Validation + # uses: gradle/actions/wrapper-validation@v3 - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 + # # Set up Java environment for the next steps + # - name: Setup Java + # uses: actions/setup-java@v4 + # with: + # distribution: zulu + # java-version: 17 - # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true + # # Setup Gradle + # - name: Setup Gradle + # uses: gradle/actions/setup-gradle@v3 + # with: + # gradle-home-cache-cleanup: true - # Set environment variables - - name: Export Properties - id: properties - shell: bash - run: | - PROPERTIES="$(./gradlew properties --console=plain -q)" - VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" - # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" - CHANGELOG="" + # # Set environment variables + # - name: Export Properties + # id: properties + # shell: bash + # run: | + # PROPERTIES="$(./gradlew properties --console=plain -q)" + # VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" + # # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" + # CHANGELOG="" - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT + # echo "version=$VERSION" >> $GITHUB_OUTPUT + # echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT - echo "changelog<> $GITHUB_OUTPUT - echo "$CHANGELOG" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT + # echo "changelog<> $GITHUB_OUTPUT + # echo "$CHANGELOG" >> $GITHUB_OUTPUT + # echo "EOF" >> $GITHUB_OUTPUT - ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier + # ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier - # Setup Node.js - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" + # # Setup Node.js + # - name: Use Node.js from .nvmrc + # uses: actions/setup-node@v4 + # with: + # node-version-file: ".nvmrc" # Cache node_modules - name: Cache core node_modules @@ -128,11 +113,11 @@ jobs: path: binary/node_modules key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} + # - name: Cache gui node_modules + # uses: actions/cache@v3 + # with: + # path: gui/node_modules + # key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} # npm install core - name: Install core node_modules @@ -141,21 +126,21 @@ jobs: npm ci # npm install gui - - name: Install gui node_modules and build - run: | - cd ../../gui - npm ci - npm run build + # - name: Install gui node_modules and build + # run: | + # cd ../../gui + # npm ci + # npm run build # Run prepackage.js script - - name: Run prepackage script - run: | - cd ../../extensions/vscode - npm ci - npm run prepackage - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + # - name: Run prepackage script + # run: | + # cd ../../extensions/vscode + # npm ci + # npm run prepackage + # env: + # # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + # GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} # npm install binary - name: Install binary node_modules @@ -183,6 +168,10 @@ jobs: echo "Validating codesigning for darwin-arm64 binary" codesign -dv --verbose=4 ../../binary/bin/darwin-arm64/continue-binary + - name: Try to run the darwin-arm64 binary + run: | + ../../binary/bin/darwin-arm64/continue-binary + # - name: Sign darwin-arm64 binary # uses: lando/code-sign-action@v2 # with: @@ -210,29 +199,29 @@ jobs: # options: --options runtime --entitlements entitlements.xml # Build plugin - - name: Build plugin - run: ./gradlew buildPlugin + # - name: Build plugin + # run: ./gradlew buildPlugin - # Prepare plugin archive content for creating artifact - - name: Prepare Plugin Artifact - id: artifact - shell: bash - run: | - cd ../../extensions/intellij/build/distributions - echo "Builds:" - ls - echo "---" - FILENAME=`ls *.zip` - unzip "$FILENAME" -d content + # # Prepare plugin archive content for creating artifact + # - name: Prepare Plugin Artifact + # id: artifact + # shell: bash + # run: | + # cd ../../extensions/intellij/build/distributions + # echo "Builds:" + # ls + # echo "---" + # FILENAME=`ls *.zip` + # unzip "$FILENAME" -d content - echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT + # echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT - # Store already-built plugin as an artifact for downloading - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.artifact.outputs.filename }} - path: ./extensions/intellij/build/distributions/content/*/* + # # Store already-built plugin as an artifact for downloading + # - name: Upload artifact + # uses: actions/upload-artifact@v4 + # with: + # name: ${{ steps.artifact.outputs.filename }} + # path: ./extensions/intellij/build/distributions/content/*/* # Upload binaries as artifacts - name: Upload artifact (darwin-arm64) From 83b7fed21eaa0767291ce6fb14c4f6b5e7b4c5e3 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 18:31:16 -0700 Subject: [PATCH 040/104] test again --- .github/workflows/jetbrains-release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 9520c4823..f19c09d4c 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -11,9 +11,9 @@ on: # release: # types: [prereleased] -# defaults: -# run: -# working-directory: extensions/intellij +defaults: + run: + working-directory: extensions/intellij concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} From 05d4e0f314ead25d1225055c23e2f07042288d4b Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 18:31:50 -0700 Subject: [PATCH 041/104] change default path --- .github/workflows/jetbrains-release.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index f19c09d4c..ee6db0646 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -11,9 +11,9 @@ on: # release: # types: [prereleased] -defaults: - run: - working-directory: extensions/intellij +# defaults: +# run: +# working-directory: extensions/intellij concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -122,7 +122,7 @@ jobs: # npm install core - name: Install core node_modules run: | - cd ../../core + cd core npm ci # npm install gui @@ -145,13 +145,13 @@ jobs: # npm install binary - name: Install binary node_modules run: | - cd ../../binary + cd binary npm ci # Build binaries - name: Build the binaries run: | - cd ../../binary + cd binary npm run build # - name: Code sign darwin binaries @@ -170,7 +170,7 @@ jobs: - name: Try to run the darwin-arm64 binary run: | - ../../binary/bin/darwin-arm64/continue-binary + ./binary/bin/darwin-arm64/continue-binary # - name: Sign darwin-arm64 binary # uses: lando/code-sign-action@v2 From c1ae7edcfb2fb71eceecb0cf190227b674007e15 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 18:37:55 -0700 Subject: [PATCH 042/104] test --- .github/workflows/jetbrains-release.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index ee6db0646..33dcf6a9f 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -133,14 +133,14 @@ jobs: # npm run build # Run prepackage.js script - # - name: Run prepackage script - # run: | - # cd ../../extensions/vscode - # npm ci - # npm run prepackage - # env: - # # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - # GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + - name: Run prepackage script + run: | + cd extensions/vscode + npm ci + npm run prepackage + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} # npm install binary - name: Install binary node_modules From 0aadbaca308f5d7b59b3c2fab97e837a2c755b7f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 18:42:07 -0700 Subject: [PATCH 043/104] fix test --- .github/workflows/jetbrains-release.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 33dcf6a9f..58a725cc1 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -160,13 +160,13 @@ jobs: # codesign --sign - ../../binary/bin/darwin-x64/continue-binary # codesign --sign - ../../binary/bin/darwin-arm64/continue-binary - - name: Validate codesigning - run: | - echo "Validating codesigning for darwin-x64 binary" - codesign -dv --verbose=4 ../../binary/bin/darwin-x64/continue-binary + # - name: Validate codesigning + # run: | + # echo "Validating codesigning for darwin-x64 binary" + # codesign -dv --verbose=4 ../../binary/bin/darwin-x64/continue-binary - echo "Validating codesigning for darwin-arm64 binary" - codesign -dv --verbose=4 ../../binary/bin/darwin-arm64/continue-binary + # echo "Validating codesigning for darwin-arm64 binary" + # codesign -dv --verbose=4 ../../binary/bin/darwin-arm64/continue-binary - name: Try to run the darwin-arm64 binary run: | From a25d56b5430e941e562296e764e2ba4f1e8b0dec Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 18:49:22 -0700 Subject: [PATCH 044/104] test 2 --- .github/workflows/jetbrains-release.yaml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 58a725cc1..53673d144 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -95,10 +95,10 @@ jobs: # ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier # # Setup Node.js - # - name: Use Node.js from .nvmrc - # uses: actions/setup-node@v4 - # with: - # node-version-file: ".nvmrc" + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" # Cache node_modules - name: Cache core node_modules @@ -168,6 +168,18 @@ jobs: # echo "Validating codesigning for darwin-arm64 binary" # codesign -dv --verbose=4 ../../binary/bin/darwin-arm64/continue-binary + - name: Upload artifact (darwin-arm64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-darwin-arm64 + path: ./binary/bin/darwin-arm64/ + + - name: Upload artifact (darwin-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-darwin-x64 + path: ./binary/bin/darwin-x64/ + - name: Try to run the darwin-arm64 binary run: | ./binary/bin/darwin-arm64/continue-binary From 0f24577bd103f7b2742ac992ee0da174be93c043 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 20:49:48 -0700 Subject: [PATCH 045/104] fix build to include package.json --- binary/build.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/binary/build.js b/binary/build.js index 1ebc4b196..cf8a2420b 100644 --- a/binary/build.js +++ b/binary/build.js @@ -238,17 +238,16 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { }.tar.gz`; execCmdSync(`curl -L -o ${targetDir}/build.tar.gz ${downloadUrl}`); execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`); - fs.copyFileSync( - `${targetDir}/build/Release/node_sqlite3.node`, - `${targetDir}/node_sqlite3.node`, - ); + + // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found + fs.writeFileSync(`${targetDir}/package.json`, ""); // Copy to build directory for testing try { const [platform, arch] = target.split("-"); if (platform === currentPlatform && arch === currentArch) { fs.copyFileSync( - `${targetDir}/node_sqlite3.node`, + `${targetDir}/build/Release/node_sqlite3.node`, `build/node_sqlite3.node`, ); } @@ -258,10 +257,6 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { } fs.unlinkSync(`${targetDir}/build.tar.gz`); - fs.rmSync(`${targetDir}/build`, { - recursive: true, - force: true, - }); // Download and unzip prebuilt esbuild binary for the target console.log(`[info] Downloading esbuild for ${target}...`); @@ -300,7 +295,8 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { `${targetDir}/continue-binary${exe}`, `${targetDir}/esbuild${exe}`, `${targetDir}/index.node`, // @lancedb - `${targetDir}/node_sqlite3.node`, + "package.json", // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found + `${targetDir}/build/Release/node_sqlite3.node`, ); } From d895d6471991d88d5b389576e4e2f172e10c62fd Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 21:00:55 -0700 Subject: [PATCH 046/104] revert CI --- .github/workflows/jetbrains-release.yaml | 142 ++++++++++------------- 1 file changed, 63 insertions(+), 79 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 53673d144..6ade07b71 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -11,9 +11,9 @@ on: # release: # types: [prereleased] -# defaults: -# run: -# working-directory: extensions/intellij +defaults: + run: + working-directory: extensions/intellij concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -59,40 +59,40 @@ jobs: p12-password: ${{ secrets.APPLE_CERT_PASSWORD }} # Validate wrapper - # - name: Gradle Wrapper Validation - # uses: gradle/actions/wrapper-validation@v3 + - name: Gradle Wrapper Validation + uses: gradle/actions/wrapper-validation@v3 # # Set up Java environment for the next steps - # - name: Setup Java - # uses: actions/setup-java@v4 - # with: - # distribution: zulu - # java-version: 17 + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 # # Setup Gradle - # - name: Setup Gradle - # uses: gradle/actions/setup-gradle@v3 - # with: - # gradle-home-cache-cleanup: true + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true - # # Set environment variables - # - name: Export Properties - # id: properties - # shell: bash - # run: | - # PROPERTIES="$(./gradlew properties --console=plain -q)" - # VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" - # # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" - # CHANGELOG="" + # Set environment variables + - name: Export Properties + id: properties + shell: bash + run: | + PROPERTIES="$(./gradlew properties --console=plain -q)" + VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" + # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" + CHANGELOG="" - # echo "version=$VERSION" >> $GITHUB_OUTPUT - # echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT - # echo "changelog<> $GITHUB_OUTPUT - # echo "$CHANGELOG" >> $GITHUB_OUTPUT - # echo "EOF" >> $GITHUB_OUTPUT + echo "changelog<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT - # ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier + ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier # # Setup Node.js - name: Use Node.js from .nvmrc @@ -113,29 +113,29 @@ jobs: path: binary/node_modules key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} - # - name: Cache gui node_modules - # uses: actions/cache@v3 - # with: - # path: gui/node_modules - # key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} + - name: Cache gui node_modules + uses: actions/cache@v3 + with: + path: gui/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} # npm install core - name: Install core node_modules run: | - cd core + cd ../../core npm ci # npm install gui - # - name: Install gui node_modules and build - # run: | - # cd ../../gui - # npm ci - # npm run build + - name: Install gui node_modules and build + run: | + cd ../../gui + npm ci + npm run build # Run prepackage.js script - name: Run prepackage script run: | - cd extensions/vscode + cd ../../extensions/vscode npm ci npm run prepackage env: @@ -145,13 +145,13 @@ jobs: # npm install binary - name: Install binary node_modules run: | - cd binary + cd ../../binary npm ci # Build binaries - name: Build the binaries run: | - cd binary + cd ../../binary npm run build # - name: Code sign darwin binaries @@ -168,22 +168,6 @@ jobs: # echo "Validating codesigning for darwin-arm64 binary" # codesign -dv --verbose=4 ../../binary/bin/darwin-arm64/continue-binary - - name: Upload artifact (darwin-arm64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-darwin-arm64 - path: ./binary/bin/darwin-arm64/ - - - name: Upload artifact (darwin-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-darwin-x64 - path: ./binary/bin/darwin-x64/ - - - name: Try to run the darwin-arm64 binary - run: | - ./binary/bin/darwin-arm64/continue-binary - # - name: Sign darwin-arm64 binary # uses: lando/code-sign-action@v2 # with: @@ -211,29 +195,29 @@ jobs: # options: --options runtime --entitlements entitlements.xml # Build plugin - # - name: Build plugin - # run: ./gradlew buildPlugin + - name: Build plugin + run: ./gradlew buildPlugin - # # Prepare plugin archive content for creating artifact - # - name: Prepare Plugin Artifact - # id: artifact - # shell: bash - # run: | - # cd ../../extensions/intellij/build/distributions - # echo "Builds:" - # ls - # echo "---" - # FILENAME=`ls *.zip` - # unzip "$FILENAME" -d content + # Prepare plugin archive content for creating artifact + - name: Prepare Plugin Artifact + id: artifact + shell: bash + run: | + cd ../../extensions/intellij/build/distributions + echo "Builds:" + ls + echo "---" + FILENAME=`ls *.zip` + unzip "$FILENAME" -d content - # echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT + echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT - # # Store already-built plugin as an artifact for downloading - # - name: Upload artifact - # uses: actions/upload-artifact@v4 - # with: - # name: ${{ steps.artifact.outputs.filename }} - # path: ./extensions/intellij/build/distributions/content/*/* + # Store already-built plugin as an artifact for downloading + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.artifact.outputs.filename }} + path: ./extensions/intellij/build/distributions/content/*/* # Upload binaries as artifacts - name: Upload artifact (darwin-arm64) From 27fe97f216bbf0daf787252fc88ca34028fca80c Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 21:21:52 -0700 Subject: [PATCH 047/104] remove to test --- .github/workflows/jetbrains-release.yaml | 32 ++++++++++-------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 6ade07b71..efb5228d3 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -322,29 +322,23 @@ jobs: run: | cd ../../binary/bin/${{ matrix.platform }}-${{ matrix.arch }} chmod +x continue-binary - chmod +x node_sqlite3.node + chmod +x build/Release/node_sqlite3.node chmod +x index.node chmod +x esbuild if: ${{ matrix.platform }} != 'win32' - - name: Copy node_sqlite3.node to necessary location - run: | - cd ../../binary - mkdir build - cp ./bin/${{ matrix.platform }}-${{ matrix.arch }}/node_sqlite3.node ./build/node_sqlite3.node + # # Run tests for binary + # - name: Run binary tests + # run: | + # cd ../../binary + # npm run test - # Run tests for binary - - name: Run binary tests - run: | - cd ../../binary - npm run test - - - name: Upload logs - if: ${{ always() }} - uses: actions/upload-artifact@v2 - with: - name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} - path: binary/.continue/logs/core.log + # - name: Upload logs + # if: ${{ always() }} + # uses: actions/upload-artifact@v2 + # with: + # name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} + # path: binary/.continue/logs/core.log # Run tests and upload a code coverage report test: @@ -424,6 +418,7 @@ jobs: # Run plugin structure verification along with IntelliJ Plugin Verifier verify: + if: false name: Verify plugin needs: [build] runs-on: ubuntu-latest @@ -478,7 +473,6 @@ jobs: - test-binaries - test - inspectCode - - verify runs-on: ubuntu-latest steps: # # Update Unreleased section with the current release note From f39326bdc41481567faca9313a125457efc025ff Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 21:36:46 -0700 Subject: [PATCH 048/104] remove unecessary move of node_sqlite3.node in intellij --- .../activities/ContinuePluginStartupActivity.kt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt index 444a4d397..e1a427040 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt @@ -206,17 +206,6 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware { val targetPath = Paths.get(corePath, target).toString() val continueCorePath = Paths.get(targetPath, "continue-binary" + (if (os == "win32") ".exe" else "")).toString() - // Copy targetPath / node_sqlite3.node to core / node_sqlite3.node - val nodeSqlite3Path = Paths.get(targetPath, "node_sqlite3.node") - - // Create the build/Release path first - File(Paths.get(corePath, "build", "Release").toString()).mkdirs() - - val coreNodeSqlite3Path = Paths.get(corePath, "build", "Release", "node_sqlite3.node") - if (!File(coreNodeSqlite3Path.toString()).exists()) { - Files.copy(nodeSqlite3Path, coreNodeSqlite3Path) - } - // esbuild needs permissions val esbuildPath = Paths.get(targetPath, "esbuild"+ (if (os == "win32") ".exe" else "")).toString() From ea772dad2aa5fb1d8255cb07cf9e131379605448 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 21:37:38 -0700 Subject: [PATCH 049/104] don't upload release asset --- .github/workflows/jetbrains-release.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index efb5228d3..30489d7db 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -490,10 +490,10 @@ jobs: path: ./build/distributions/ # Upload artifact as a release asset - - name: Upload Release Asset - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* + # - name: Upload Release Asset + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* # Publish the plugin to JetBrains Marketplace - name: Publish Plugin From 4cf31b85fe9c12381f34c1dabb1c9d4f13787fd9 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 22:08:45 -0700 Subject: [PATCH 050/104] remove dep --- .github/workflows/jetbrains-release.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 30489d7db..944dfac2f 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -472,7 +472,6 @@ jobs: - build - test-binaries - test - - inspectCode runs-on: ubuntu-latest steps: # # Update Unreleased section with the current release note From cffc9a803d52180e90335a70610d867751a26524 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 22:20:26 -0700 Subject: [PATCH 051/104] test tests --- .github/workflows/preview.yaml | 57 ++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index aea470286..7d3e6f23f 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -1,11 +1,14 @@ name: Publish Preview Extension on: - create: - tags: - - "v0.9.*-vscode" + push: branches: - - dev + - nate/fix-ci-tests + # create: + # tags: + # - "v0.9.*-vscode" + # branches: + # - dev jobs: build: @@ -52,8 +55,8 @@ jobs: with: fetch-depth: 0 # This ensures all tags are fetched - - name: Checkout tag - run: git checkout ${GITHUB_REF#refs/tags/} + # - name: Checkout tag + # run: git checkout ${GITHUB_REF#refs/tags/} # 2. Install npm dependencies - name: Use Node.js from .nvmrc @@ -61,11 +64,11 @@ jobs: with: node-version-file: ".nvmrc" - - name: Cache extension node_modules - uses: actions/cache@v3 - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} + # - name: Cache extension node_modules + # uses: actions/cache@v3 + # with: + # path: extensions/vscode/node_modules + # key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} - name: Cache core node_modules uses: actions/cache@v3 @@ -73,24 +76,24 @@ jobs: path: core/node_modules key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} + # - name: Cache gui node_modules + # uses: actions/cache@v3 + # with: + # path: gui/node_modules + # key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - name: Install extension Dependencies - run: | - cd extensions/vscode - npm ci - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + # - name: Install extension Dependencies + # run: | + # cd extensions/vscode + # npm ci + # env: + # # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + # GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - name: Install gui Dependencies - run: | - cd gui - npm ci + # - name: Install gui Dependencies + # run: | + # cd gui + # npm ci - name: Install Core Dependencies run: | From e1c28e5d65aa1cf2e0a452158b8f168404bbb0f0 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 23:01:59 -0700 Subject: [PATCH 052/104] releasePlugin right after build --- .github/workflows/jetbrains-release.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 944dfac2f..14371345f 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -198,6 +198,15 @@ jobs: - name: Build plugin run: ./gradlew buildPlugin + # Publish the plugin to JetBrains Marketplace + - name: Publish Plugin + env: + PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} + CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} + run: ./gradlew publishPlugin + # Prepare plugin archive content for creating artifact - name: Prepare Plugin Artifact id: artifact @@ -251,6 +260,7 @@ jobs: path: ./binary/bin/linux-x64/ test-binaries: + if: false needs: build strategy: matrix: @@ -467,6 +477,7 @@ jobs: path: ${{ github.workspace }}/build/reports/pluginVerifier upload-release: + if: false name: Upload Release needs: - build From 69215a76271d63441f0f8646e09e5ff2ff149fd4 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Aug 2024 23:13:04 -0700 Subject: [PATCH 053/104] version update --- .github/workflows/jetbrains-release.yaml | 23 +++++++++++------------ extensions/intellij/gradle.properties | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 14371345f..8f7c18b3f 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -260,7 +260,6 @@ jobs: path: ./binary/bin/linux-x64/ test-binaries: - if: false needs: build strategy: matrix: @@ -337,18 +336,18 @@ jobs: chmod +x esbuild if: ${{ matrix.platform }} != 'win32' - # # Run tests for binary - # - name: Run binary tests - # run: | - # cd ../../binary - # npm run test + # Run tests for binary + - name: Run binary tests + run: | + cd ../../binary + npm run test - # - name: Upload logs - # if: ${{ always() }} - # uses: actions/upload-artifact@v2 - # with: - # name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} - # path: binary/.continue/logs/core.log + - name: Upload logs + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} + path: binary/.continue/logs/core.log # Run tests and upload a code coverage report test: diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index c61a7c46e..f5e4edb49 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -4,7 +4,7 @@ pluginGroup = com.github.continuedev.continueintellijextension pluginName = continue-intellij-extension pluginRepositoryUrl = https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion = 0.0.60 +pluginVersion = 0.0.61 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 223 From 9db4ad886a9d9febe79b930406bc2e4eb87cbe7a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 07:46:38 -0700 Subject: [PATCH 054/104] test --- .github/workflows/preview.yaml | 9 ++++++++- core/indexing/CodebaseIndexer.test.ts | 14 +++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 7d3e6f23f..6263c6bbd 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -99,11 +99,18 @@ jobs: run: | cd core npm ci + npm install @lancedb/vectordb-linux-x64-gnu + + - name: Install lance + run: | + cd core + npm install @lancedb/vectordb-linux-x64-gnu + if: matrix.os == 'ubuntu-latest' - name: Run core tests run: | cd core - npm run test + npm run test -- ./indexing/CodebaseIndexer.test.ts env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} diff --git a/core/indexing/CodebaseIndexer.test.ts b/core/indexing/CodebaseIndexer.test.ts index 221035737..cce5d61d8 100644 --- a/core/indexing/CodebaseIndexer.test.ts +++ b/core/indexing/CodebaseIndexer.test.ts @@ -3,12 +3,6 @@ import { execSync } from "node:child_process"; import fs from "node:fs"; import path from "node:path"; import { ContinueServerClient } from "../continueServer/stubs/client.js"; -import { CodebaseIndexer, PauseToken } from "./CodebaseIndexer.js"; -import { getComputeDeleteAddRemove } from "./refreshIndex.js"; -import { TestCodebaseIndex } from "./TestCodebaseIndex.js"; -import { CodebaseIndex } from "./types.js"; -import { walkDir } from "./walkDir.js"; -import { getIndexSqlitePath } from "../util/paths.js"; import { testConfigHandler, testIde } from "../test/util/fixtures.js"; import { addToTestDir, @@ -16,6 +10,12 @@ import { tearDownTestDir, TEST_DIR, } from "../test/util/testDir.js"; +import { getIndexSqlitePath } from "../util/paths.js"; +import { CodebaseIndexer, PauseToken } from "./CodebaseIndexer.js"; +import { getComputeDeleteAddRemove } from "./refreshIndex.js"; +import { TestCodebaseIndex } from "./TestCodebaseIndex.js"; +import { CodebaseIndex } from "./types.js"; +import { walkDir } from "./walkDir.js"; jest.useFakeTimers(); @@ -57,7 +57,7 @@ class TestCodebaseIndexer extends CodebaseIndexer { // These are more like integration tests, whereas we should separately test // the individual CodebaseIndex classes -describe.skip("CodebaseIndexer", () => { +describe("CodebaseIndexer", () => { const pauseToken = new PauseToken(false); const continueServerClient = new ContinueServerClient(undefined, undefined); const codebaseIndexer = new TestCodebaseIndexer( From e852c965e22fb6f1ed06a7d55b9f174441f5ef44 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 07:49:47 -0700 Subject: [PATCH 055/104] fix git error --- core/indexing/CodebaseIndexer.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/indexing/CodebaseIndexer.test.ts b/core/indexing/CodebaseIndexer.test.ts index cce5d61d8..f05acfc16 100644 --- a/core/indexing/CodebaseIndexer.test.ts +++ b/core/indexing/CodebaseIndexer.test.ts @@ -71,6 +71,9 @@ describe("CodebaseIndexer", () => { beforeAll(async () => { tearDownTestDir(); setUpTestDir(); + + execSync('git config --global user.email "test@example.com"'); + execSync('git config --global user.name "Test"'); }); afterAll(async () => { From f618f9d64639995054260cc90e722f5190c2681e Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 07:52:43 -0700 Subject: [PATCH 056/104] try something else --- .github/workflows/preview.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 6263c6bbd..5f3fa5ec9 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -95,11 +95,12 @@ jobs: # cd gui # npm ci + # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - name: Install Core Dependencies run: | cd core npm ci - npm install @lancedb/vectordb-linux-x64-gnu + npm i vectordb - name: Install lance run: | From d4e7372cc8c788b18717e36e6ce21ad24647a65a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 09:44:24 -0700 Subject: [PATCH 057/104] rename intellij to jetbrains --- .github/workflows/README.md | 4 +-- CHANGELOG.md | 2 +- CONTRIBUTING.md | 2 +- docs/docs/changelog.mdx | 4 +-- docs/docs/troubleshooting.md | 2 +- extensions/vscode/scripts/prepackage.js | 11 ++++++--- extensions/vscode/scripts/utils.js | 33 +++++++++++-------------- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index f22d06955..ff1b7bd22 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -7,7 +7,7 @@ When merging to `preview`: - the VS Code extension along with Rust extension is built and uploaded as an artifact - all of the artifacts are downloaded and pushed to the store/registry all at once, as full releases. - the version is bumped and this change is commited to preview -- in the future, the Intellij extension will be built and uploaded to the marketplace here +- in the future, the JetBrains extension will be built and uploaded to the marketplace here ## main @@ -16,4 +16,4 @@ When merging to `main`: - the VS Code extension along with Rust extension is built and uploaded as an artifact - all of the artifacts are downloaded and pushed to the store/registry all at once, as full releases. - the version is bumped and this change is commited to main -- in the future, the Intellij extension will be built and uploaded to the marketplace here +- in the future, the JetBrains extension will be built and uploaded to the marketplace here diff --git a/CHANGELOG.md b/CHANGELOG.md index 010e9d1e3..268bbe613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,4 +3,4 @@ Separate changelogs are kept for each extension: - [VS Code Extension](./extensions/vscode/CHANGELOG.md) -- [Intellij Extension](./extensions/intellij/CHANGELOG.md) +- [JetBrains Extension](./extensions/intellij/CHANGELOG.md) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2192b2b8d..0a998802a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -152,7 +152,7 @@ Pre-requisite: You should use the Intellij IDE, which can be downloaded [here](h ##### Debugging -Continue's JetBrains extension shares much of the code with the VS Code extension by utilizing shared code in the `core` directory and packaging it in a binary in the `binary` directory. The Intellij extension (written in Kotlin) is then able to communicate over stdin/stdout in the [CoreMessenger.kt](./extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt) file. +Continue's JetBrains extension shares much of the code with the VS Code extension by utilizing shared code in the `core` directory and packaging it in a binary in the `binary` directory. The JetBrains extension (written in Kotlin) is then able to communicate over stdin/stdout in the [CoreMessenger.kt](./extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt) file. For the sake of rapid development, it is also possible to configure this communication to happen over local TCP sockets: diff --git a/docs/docs/changelog.mdx b/docs/docs/changelog.mdx index 990953abe..3b703ce52 100644 --- a/docs/docs/changelog.mdx +++ b/docs/docs/changelog.mdx @@ -1,6 +1,6 @@ --- title: 📝 Changelog -description: Changelogs for the latest releases of the VSCode and IntelliJ extensions +description: Changelogs for the latest releases of the VSCode and JetBrains extensions keywords: [changelog] hide_table_of_contents: true --- @@ -8,7 +8,7 @@ hide_table_of_contents: true import VSCodeChangelog from "../../extensions/vscode/CHANGELOG.md"; import IntelliJChangelog from "../../extensions/intellij/CHANGELOG.md"; -Below are the changelogs for the latest releases of the VSCode and IntelliJ extensions. Prior to 2024-07-02, the changelogs do not reflect all updates. +Below are the changelogs for the latest releases of the VSCode and JetBrains extensions. Prior to 2024-07-02, the changelogs do not reflect all updates. import TOCInline from "@theme/TOCInline"; diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.md index 459271d47..44742c0de 100644 --- a/docs/docs/troubleshooting.md +++ b/docs/docs/troubleshooting.md @@ -4,7 +4,7 @@ description: Troubleshooting while waiting for help during beta / alpha testing keywords: [reload, delete, manually, logs, server, console] --- -The Continue VS Code extension is currently in beta, and the Intellij extension is in Alpha. If you are having trouble, please follow the steps below. +The Continue VS Code extension is currently in beta, and the JetBrains extension is in Alpha. If you are having trouble, please follow the steps below. 1. [Check the logs](#check-the-logs) 2. [Try the latest pre-release](#download-the-latest-pre-release) diff --git a/extensions/vscode/scripts/prepackage.js b/extensions/vscode/scripts/prepackage.js index f7ca0e5d7..ad2ba5773 100644 --- a/extensions/vscode/scripts/prepackage.js +++ b/extensions/vscode/scripts/prepackage.js @@ -94,7 +94,7 @@ const exe = os === "win32" ? ".exe" : ""; execCmdSync("npm run build"); } - // Copy over the dist folder to the Intellij extension // + // Copy over the dist folder to the JetBrains extension // const intellijExtensionWebviewPath = path.join( "..", "extensions", @@ -114,7 +114,7 @@ const exe = os === "win32" ? ".exe" : ""; ncp("dist", intellijExtensionWebviewPath, (error) => { if (error) { console.warn( - "[error] Error copying React app build to Intellij extension: ", + "[error] Error copying React app build to JetBrains extension: ", error, ); reject(error); @@ -136,7 +136,7 @@ const exe = os === "win32" ? ".exe" : ""; path.join(intellijExtensionWebviewPath, "onigasm.wasm"), ); - console.log("[info] Copied gui build to Intellij extension"); + console.log("[info] Copied gui build to JetBrains extension"); // Then copy over the dist folder to the VSCode extension // const vscodeGuiPath = path.join("../extensions/vscode/gui"); @@ -248,7 +248,10 @@ const exe = os === "win32" ? ".exe" : ""; "../../../core/llm/tiktokenWorkerPool.mjs", ]; for (const f of filesToCopy) { - fs.copyFileSync(path.join(__dirname, f), path.join(__dirname, "..", "out", path.basename(f))); + fs.copyFileSync( + path.join(__dirname, f), + path.join(__dirname, "..", "out", path.basename(f)), + ); console.log(`[info] Copied ${path.basename(f)}`); } diff --git a/extensions/vscode/scripts/utils.js b/extensions/vscode/scripts/utils.js index 6a129bc61..93c1928ce 100644 --- a/extensions/vscode/scripts/utils.js +++ b/extensions/vscode/scripts/utils.js @@ -78,7 +78,7 @@ async function buildGui(isGhAction) { execCmdSync("npm run build"); } - // Copy over the dist folder to the Intellij extension // + // Copy over the dist folder to the JetBrains extension // const intellijExtensionWebviewPath = path.join( "..", "extensions", @@ -98,7 +98,7 @@ async function buildGui(isGhAction) { ncp("dist", intellijExtensionWebviewPath, (error) => { if (error) { console.warn( - "[error] Error copying React app build to Intellij extension: ", + "[error] Error copying React app build to JetBrains extension: ", error, ); reject(error); @@ -120,7 +120,7 @@ async function buildGui(isGhAction) { path.join(intellijExtensionWebviewPath, "onigasm.wasm"), ); - console.log("[info] Copied gui build to Intellij extension"); + console.log("[info] Copied gui build to JetBrains extension"); // Then copy over the dist folder to the VSCode extension // const vscodeGuiPath = path.join("../extensions/vscode/gui"); @@ -256,7 +256,7 @@ async function copyNodeModules() { "@esbuild", "@lancedb", "@vscode/ripgrep", - "workerpool" + "workerpool", ]; fs.mkdirSync("out/node_modules", { recursive: true }); @@ -328,15 +328,13 @@ async function downloadEsbuildBinary(target) { "win32-x64": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", }[target]; - execCmdSync( - `curl -L -o out/tmp/esbuild.tgz ${downloadUrl}`, - ); + execCmdSync(`curl -L -o out/tmp/esbuild.tgz ${downloadUrl}`); execCmdSync("cd out/tmp && tar -xvzf esbuild.tgz"); // Copy the installed package back to the current directory let tmpPath = "out/tmp/package/bin"; let outPath = `out/node_modules/@esbuild/${target}/bin`; if (target.startsWith("win")) { - tmpPath = 'out/tmp/package'; + tmpPath = "out/tmp/package"; outPath = `out/node_modules/@esbuild/${target}`; } @@ -347,10 +345,7 @@ async function downloadEsbuildBinary(target) { { dereference: true }, (error) => { if (error) { - console.error( - `[error] Error copying esbuild package`, - error, - ); + console.error(`[error] Error copying esbuild package`, error); reject(error); } else { resolve(); @@ -358,7 +353,7 @@ async function downloadEsbuildBinary(target) { }, ); }); - rimrafSync("out/tmp") + rimrafSync("out/tmp"); } async function downloadSqliteBinary(target) { @@ -408,7 +403,8 @@ async function copySqliteBinary() { async function downloadRipgrepBinary(target) { console.log("[info] Downloading pre-built ripgrep binary"); rimrafSync("node_modules/@vscode/ripgrep/bin"); - fs.mkdirSync("node_modules/@vscode/ripgrep/bin", { recursive: true });4 + fs.mkdirSync("node_modules/@vscode/ripgrep/bin", { recursive: true }); + 4; const downloadUrl = { "darwin-arm64": "https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-10/ripgrep-v13.0.0-10-aarch64-apple-darwin.tar.gz", @@ -424,8 +420,7 @@ async function downloadRipgrepBinary(target) { "https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-10/ripgrep-v13.0.0-10-x86_64-pc-windows-msvc.zip", }[target]; - - if(target.startsWith("win")) { + if (target.startsWith("win")) { execCmdSync( `curl -L -o node_modules/@vscode/ripgrep/bin/build.zip ${downloadUrl}`, ); @@ -435,7 +430,9 @@ async function downloadRipgrepBinary(target) { execCmdSync( `curl -L -o node_modules/@vscode/ripgrep/bin/build.tar.gz ${downloadUrl}`, ); - execCmdSync("cd node_modules/@vscode/ripgrep/bin && tar -xvzf build.tar.gz"); + execCmdSync( + "cd node_modules/@vscode/ripgrep/bin && tar -xvzf build.tar.gz", + ); fs.unlinkSync("node_modules/@vscode/ripgrep/bin/build.tar.gz"); } } @@ -512,5 +509,5 @@ module.exports = { installNodeModuleInTempDirAndCopyToCurrent, downloadSqliteBinary, downloadRipgrepBinary, - copyTokenizers + copyTokenizers, }; From e703e8094208a7bc8503f3131a974530cc7aa7c0 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 09:44:41 -0700 Subject: [PATCH 058/104] include vscode/jetbrains in telemetry --- core/config/profile/doLoadConfig.ts | 2 +- core/util/posthog.ts | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 16f72d40e..b4556f826 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -48,7 +48,7 @@ export default async function doLoadConfig( await Telemetry.setup( newConfig.allowAnonymousTelemetry ?? true, await ide.getUniqueId(), - ideInfo.extensionVersion, + ideInfo, ); if (newConfig.analytics) { diff --git a/core/util/posthog.ts b/core/util/posthog.ts index 3a79814d0..be62977fc 100644 --- a/core/util/posthog.ts +++ b/core/util/posthog.ts @@ -1,12 +1,13 @@ import os from "node:os"; import { TeamAnalytics } from "../control-plane/TeamAnalytics.js"; +import { IdeInfo } from "../index.js"; export class Telemetry { // Set to undefined whenever telemetry is disabled static client: any = undefined; static uniqueId = "NOT_UNIQUE"; static os: string | undefined = undefined; - static extensionVersion: string | undefined = undefined; + static ideInfo: IdeInfo | undefined = undefined; static async capture( event: string, @@ -19,7 +20,9 @@ export class Telemetry { properties: { ...properties, os: Telemetry.os, - extensionVersion: Telemetry.extensionVersion, + extensionVersion: Telemetry.ideInfo?.extensionVersion, + ideName: Telemetry.ideInfo?.name, + ideType: Telemetry.ideInfo?.ideType, }, }); @@ -32,14 +35,10 @@ export class Telemetry { Telemetry.client?.shutdown(); } - static async setup( - allow: boolean, - uniqueId: string, - extensionVersion: string, - ) { + static async setup(allow: boolean, uniqueId: string, ideInfo: IdeInfo) { Telemetry.uniqueId = uniqueId; Telemetry.os = os.platform(); - Telemetry.extensionVersion = extensionVersion; + Telemetry.ideInfo = ideInfo; if (!allow) { Telemetry.client = undefined; From 5db3a581c3565730df5ce561ed1b5cbc6b278949 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 12:12:08 -0700 Subject: [PATCH 059/104] reduce posthog costs, report core exits --- extensions/intellij/build.gradle.kts | 1 + .../ContinuePluginStartupActivity.kt | 11 ++++++++ .../continue/CoreMessenger.kt | 15 ++++++---- .../services/TelemetryService.kt | 28 +++++++++++++++++++ gui/src/hooks/CustomPostHogProvider.tsx | 2 ++ 5 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/TelemetryService.kt diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index 766cf3ebd..8146cb32c 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -37,6 +37,7 @@ dependencies { implementation("io.ktor:ktor-server-cors:2.3.7"){ exclude(group = "org.slf4j", module = "slf4j-api") } + implementation("com.posthog.java:posthog:1.+") } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt index e1a427040..caf9b4720 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt @@ -9,6 +9,7 @@ import com.github.continuedev.continueintellijextension.listeners.ContinuePlugin import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService import com.github.continuedev.continueintellijextension.services.SettingsListener +import com.github.continuedev.continueintellijextension.services.TelemetryService import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.KeyboardShortcut import com.intellij.openapi.application.ApplicationManager @@ -211,6 +212,16 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware { val coreMessenger = CoreMessenger(project, esbuildPath, continueCorePath, ideProtocolClient) continuePluginService.coreMessenger = coreMessenger + + coreMessenger.request("config/getSerializedProfileInfo", null, null) { resp -> + val data = resp as? Map + val profileInfo = data?.get("config") as? Map + val allowAnonymousTelemetry = profileInfo?.get("allowAnonymousTelemetry") as? Boolean + val telemetryService = service() + if (allowAnonymousTelemetry == true || allowAnonymousTelemetry == null) { + telemetryService.setup(getMachineUniqueID()) + } + } } } } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt index ded887c76..4d4e9f9ba 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt @@ -1,15 +1,12 @@ package com.github.continuedev.continueintellijextension.`continue` + import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService -import java.io.BufferedReader -import java.io.InputStreamReader -import java.io.OutputStreamWriter - -import java.io.* - +import com.github.continuedev.continueintellijextension.services.TelemetryService import com.google.gson.Gson import com.intellij.openapi.components.service import com.intellij.openapi.project.Project +import java.io.* import java.net.Socket import java.nio.charset.StandardCharsets import java.nio.file.Files @@ -241,6 +238,12 @@ class CoreMessenger(private val project: Project, esbuildPath: String, continueC val err = process?.errorStream?.bufferedReader()?.readText()?.trim() println("Core process exited with output: $err") ideProtocolClient.showMessage("Core process exited with output: $err") + + // Log the cause of the failure + val telemetryService = service() + telemetryService.capture("jetbrains_core_exit", mapOf( + "error" to err + )) } Thread { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/TelemetryService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/TelemetryService.kt new file mode 100644 index 000000000..5b7f00678 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/TelemetryService.kt @@ -0,0 +1,28 @@ +package com.github.continuedev.continueintellijextension.services + +import com.intellij.openapi.components.Service +import com.posthog.java.PostHog +import com.posthog.java.PostHog.Builder + +@Service +class TelemetryService { + private val POSTHOG_API_KEY = "phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs" + private var posthog: PostHog? = null; + private var distinctId: String? = null; + + fun setup(distinctId: String) { + this.posthog = Builder(POSTHOG_API_KEY).host("https://app.posthog.com").build() + this.distinctId = distinctId + } + + fun capture(eventName: String, properties: Map) { + if (this.posthog == null || this.distinctId == null) { + return; + } + this.posthog?.capture(this.distinctId, eventName, properties) + } + + fun shutdown() { + this.posthog?.shutdown() + } +} \ No newline at end of file diff --git a/gui/src/hooks/CustomPostHogProvider.tsx b/gui/src/hooks/CustomPostHogProvider.tsx index 1d93889df..592288bb8 100644 --- a/gui/src/hooks/CustomPostHogProvider.tsx +++ b/gui/src/hooks/CustomPostHogProvider.tsx @@ -16,7 +16,9 @@ const CustomPostHogProvider = ({ children }: PropsWithChildren) => { posthog.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", { api_host: "https://app.posthog.com", disable_session_recording: true, + autocapture: false, // // We need to manually track pageviews since we're a SPA + capture_pageleave: false, capture_pageview: false, }); posthog.identify(window.vscMachineId); From a841e55b44dc7278d4762405fc691866c2584651 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 13:10:45 -0700 Subject: [PATCH 060/104] remove unnecessary telemetry --- core/indexing/LanceDbIndex.ts | 3 +-- core/indexing/docs/DocsService.ts | 13 +++++++------ core/llm/llms/FreeTrial.ts | 26 +++++++++++++------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index 69e138ddc..7c4787529 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -1,7 +1,7 @@ // NOTE: vectordb requirement must be listed in extensions/vscode to avoid error import { RunResult } from "sqlite3"; import { v4 as uuidv4 } from "uuid"; -import { Table } from "vectordb"; +import lance, { Table } from "vectordb"; import { IContinueServerClient } from "../continueServer/interface.js"; import { BranchAndDir, @@ -21,7 +21,6 @@ import { PathAndCacheKey, RefreshIndexResults, } from "./types.js"; -import lance from "vectordb"; // LanceDB converts to lowercase, so names must all be lowercase interface LanceDbRow { diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 1e8a8245c..dbf1910dc 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -722,12 +722,13 @@ export default class DocsService { await this.isJetBrainsAndPreIndexedDocsProvider(); if (isJetBrainsAndPreIndexedDocsProvider) { - this.ide.errorPopup( - "The 'transformers.js' embeddings provider currently cannot be used to index " + - "documentation in JetBrains. To enable documentation indexing, you can use " + - "any of the other providers described in the docs: " + - "https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers", - ); + // A bit noisy for teams users whom have no choice if their admin is the one who didn't setup an embeddingsProvider + // this.ide.errorPopup( + // "The 'transformers.js' embeddings provider currently cannot be used to index " + + // "documentation in JetBrains. To enable documentation indexing, you can use " + + // "any of the other providers described in the docs: " + + // "https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers", + // ); this.globalContext.update( "curEmbeddingsProviderId", diff --git a/core/llm/llms/FreeTrial.ts b/core/llm/llms/FreeTrial.ts index 9fc59313b..10632b90f 100644 --- a/core/llm/llms/FreeTrial.ts +++ b/core/llm/llms/FreeTrial.ts @@ -2,7 +2,6 @@ import { TRIAL_FIM_MODEL } from "../../config/onboarding.js"; import { getHeaders } from "../../continueServer/stubs/headers.js"; import { constants } from "../../deploy/constants.js"; import { ChatMessage, CompletionOptions, ModelProvider } from "../../index.js"; -import { Telemetry } from "../../util/posthog.js"; import { BaseLLM } from "../index.js"; import { streamResponse } from "../stream.js"; @@ -29,18 +28,19 @@ class FreeTrial extends BaseLLM { } private async _countTokens(prompt: string, model: string, isPrompt: boolean) { - if (!Telemetry.client) { - throw new Error( - "In order to use the free trial, telemetry must be enabled so that we can monitor abuse. To enable telemetry, set \"allowAnonymousTelemetry\": true in config.json and make sure the box is checked in IDE settings. If you use your own model (local or API key), telemetry will never be required.", - ); - } - const event = isPrompt - ? "free_trial_prompt_tokens" - : "free_trial_completion_tokens"; - Telemetry.capture(event, { - tokens: this.countTokens(prompt), - model, - }); + // Removed to reduce PostHog bill + // if (!Telemetry.client) { + // throw new Error( + // "In order to use the free trial, telemetry must be enabled so that we can monitor abuse. To enable telemetry, set \"allowAnonymousTelemetry\": true in config.json and make sure the box is checked in IDE settings. If you use your own model (local or API key), telemetry will never be required.", + // ); + // } + // const event = isPrompt + // ? "free_trial_prompt_tokens" + // : "free_trial_completion_tokens"; + // Telemetry.capture(event, { + // tokens: this.countTokens(prompt), + // model, + // }); } private _convertArgs(options: CompletionOptions): any { From 77b4b67282f1dcfdeaf2d74d60b074509467f030 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 13:31:18 -0700 Subject: [PATCH 061/104] improved indexing error handling --- binary/build.js | 14 +++++++- core/indexing/CodeSnippetsIndex.ts | 1 - core/indexing/CodebaseIndexer.ts | 53 ++++++++++++++++++------------ core/indexing/refreshIndex.ts | 4 +-- 4 files changed, 47 insertions(+), 25 deletions(-) diff --git a/binary/build.js b/binary/build.js index cf8a2420b..016afe9bd 100644 --- a/binary/build.js +++ b/binary/build.js @@ -240,7 +240,19 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`); // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found - fs.writeFileSync(`${targetDir}/package.json`, ""); + fs.writeFileSync( + `${targetDir}/package.json`, + JSON.stringify( + { + name: "binary", + version: "1.0.0", + author: "Continue Dev, Inc", + license: "Apache-2.0", + }, + undefined, + 2, + ), + ); // Copy to build directory for testing try { diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index 4dd56e4c2..0b97696bf 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -17,7 +17,6 @@ import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex.js"; import { IndexResultType, MarkCompleteCallback, - PathAndCacheKey, RefreshIndexResults, type CodebaseIndex, } from "./types.js"; diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index da06bb0d9..b377d5a2f 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -1,7 +1,7 @@ import * as fs from "fs/promises"; import { ConfigHandler } from "../config/ConfigHandler.js"; import { IContinueServerClient } from "../continueServer/interface.js"; -import { IDE, IndexTag, IndexingProgressUpdate } from "../index.js"; +import { IDE, IndexingProgressUpdate, IndexTag } from "../index.js"; import { extractMinimalStackTraceInfo } from "../util/extractMinimalStackTraceInfo.js"; import { getIndexSqlitePath, getLanceDbPath } from "../util/paths.js"; import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex.js"; @@ -126,6 +126,12 @@ export class CodebaseIndexer { results.removeTag = []; results.addTag = []; results.del = []; + + // Don't update if nothing to update. Some of the indices might do unnecessary setup work + if (results.compute.length === 0) { + continue; + } + for await (const _ of index.update( tag, results, @@ -371,28 +377,33 @@ export class CodebaseIndexer { results.addTag.length + results.removeTag.length; let completedOps = 0; - for (const subResult of this.batchRefreshIndexResults(results)) { - for await (const { desc } of codebaseIndex.update( - tag, - subResult, - markComplete, - repoName, - )) { - yield { - progress: progress, - desc, - status: "indexing", - }; + + // Don't update if nothing to update. Some of the indices might do unnecessary setup work + if (totalOps > 0) { + for (const subResult of this.batchRefreshIndexResults(results)) { + for await (const { desc } of codebaseIndex.update( + tag, + subResult, + markComplete, + repoName, + )) { + yield { + progress: progress, + desc, + status: "indexing", + }; + } + completedOps += + subResult.compute.length + + subResult.del.length + + subResult.addTag.length + + subResult.removeTag.length; + progress = + (completedIndexCount + completedOps / totalOps) * + (1 / indexesToBuild.length); } - completedOps += - subResult.compute.length + - subResult.del.length + - subResult.addTag.length + - subResult.removeTag.length; - progress = - (completedIndexCount + completedOps / totalOps) * - (1 / indexesToBuild.length); } + await markComplete(lastUpdated, IndexResultType.UpdateLastUpdated); completedIndexCount += 1; } diff --git a/core/indexing/refreshIndex.ts b/core/indexing/refreshIndex.ts index c60a1a4d3..3404a22d5 100644 --- a/core/indexing/refreshIndex.ts +++ b/core/indexing/refreshIndex.ts @@ -1,8 +1,8 @@ import crypto from "node:crypto"; import * as fs from "node:fs"; +import plimit from "p-limit"; import { open, type Database } from "sqlite"; import sqlite3 from "sqlite3"; -import plimit from "p-limit"; import { IndexTag, IndexingProgressUpdate } from "../index.js"; import { getIndexSqlitePath } from "../util/paths.js"; import { @@ -391,7 +391,7 @@ export async function getComputeDeleteAddRemove( lastUpdated, async (items, resultType) => { // Update tag catalog - markComplete(items, resultType); + await markComplete(items, resultType); // Update the global cache const results: any = { From f19c89148e0d7ea79c74bfcb5a98f8bcd0450d8f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 15:09:19 -0700 Subject: [PATCH 062/104] cleaning --- .github/workflows/jetbrains-release.yaml | 21 --------------------- .vscode/settings.json | 1 + 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 8f7c18b3f..3897662be 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -160,14 +160,6 @@ jobs: # codesign --sign - ../../binary/bin/darwin-x64/continue-binary # codesign --sign - ../../binary/bin/darwin-arm64/continue-binary - # - name: Validate codesigning - # run: | - # echo "Validating codesigning for darwin-x64 binary" - # codesign -dv --verbose=4 ../../binary/bin/darwin-x64/continue-binary - - # echo "Validating codesigning for darwin-arm64 binary" - # codesign -dv --verbose=4 ../../binary/bin/darwin-arm64/continue-binary - # - name: Sign darwin-arm64 binary # uses: lando/code-sign-action@v2 # with: @@ -181,19 +173,6 @@ jobs: # apple-product-id: dev.continue.continue-binary # options: --options runtime --entitlements entitlements.xml - # - name: Sign darwin-x64 binary - # uses: lando/code-sign-action@v2 - # with: - # file: ./binary/bin/darwin-x64/continue-binary - # certificate-data: ${{ secrets.APPLE_CERT_DATA }} - # certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} - # apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} - # apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} - # apple-notary-tool: altool - # apple-team-id: 43XFLY66ZD - # apple-product-id: dev.continue.continue-binary - # options: --options runtime --entitlements entitlements.xml - # Build plugin - name: Build plugin run: ./gradlew buildPlugin diff --git a/.vscode/settings.json b/.vscode/settings.json index 060bc5e6c..f56d10f61 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,6 +15,7 @@ }, "search.exclude": { "**/binary": true, + "binary/": false, "**/core/vendor/**": true, "**/gui/dist": true } From 67cbfb12ee4d2cdebe5058788efbb69f37d5d070 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 15:09:30 -0700 Subject: [PATCH 063/104] add debug logs to core.log --- binary/src/logging.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/binary/src/logging.ts b/binary/src/logging.ts index cba34855c..b6dbfba2c 100644 --- a/binary/src/logging.ts +++ b/binary/src/logging.ts @@ -11,5 +11,6 @@ export function setupCoreLogging() { console.log = logger; console.error = logger; console.warn = logger; + console.debug = logger; console.log("[info] Starting Continue core..."); } From 998303b2e61f962e70d79e6b8cf9a8e3ad571fd6 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 15:30:35 -0700 Subject: [PATCH 064/104] fix binary tests --- binary/src/IpcMessenger.ts | 2 +- core/config/promptFile.ts | 2 +- core/util/reverseMessageIde.ts | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/binary/src/IpcMessenger.ts b/binary/src/IpcMessenger.ts index 66acb1448..341372d8e 100644 --- a/binary/src/IpcMessenger.ts +++ b/binary/src/IpcMessenger.ts @@ -38,7 +38,7 @@ class IPCMessengerBase< } this.send(msg.messageType, { done: true }, msg.messageId); } else { - this.send(msg.messageType, response || {}, msg.messageId); + this.send(msg.messageType, response, msg.messageId); } } catch (e: any) { console.warn(`Error running handler for "${msg.messageType}": `, e); diff --git a/core/config/promptFile.ts b/core/config/promptFile.ts index 92d558aaf..f1bfc898d 100644 --- a/core/config/promptFile.ts +++ b/core/config/promptFile.ts @@ -4,8 +4,8 @@ import * as YAML from "yaml"; import type { IDE, SlashCommand } from ".."; import { walkDir } from "../indexing/walkDir"; import { stripImages } from "../llm/images"; -import { getBasename } from "../util/index"; import { renderTemplatedString } from "../promptFiles/renderTemplatedString"; +import { getBasename } from "../util/index"; export const DEFAULT_PROMPTS_FOLDER = ".prompts"; diff --git a/core/util/reverseMessageIde.ts b/core/util/reverseMessageIde.ts index 1e5a2d1ca..a65f1f1f2 100644 --- a/core/util/reverseMessageIde.ts +++ b/core/util/reverseMessageIde.ts @@ -124,6 +124,11 @@ export class ReverseMessageIde { return this.ide.listFolders(); }); + this.on("getControlPlaneSessionInfo", async (msg) => { + // Not supported in testing + return undefined; + }); + this.on("getContinueDir", () => { return this.ide.getContinueDir(); }); From 37f444d87675cc3b349f3809b5a2e1491888672f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 15:35:59 -0700 Subject: [PATCH 065/104] release from tags --- .github/workflows/jetbrains-release.yaml | 41 +++++++++++------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 3897662be..56cd88b16 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -5,11 +5,8 @@ name: Release on: - push: - branches: - - nate/apple-developer-finally - # release: - # types: [prereleased] + release: + types: [prereleased] defaults: run: @@ -20,24 +17,24 @@ concurrency: cancel-in-progress: true jobs: - # check_release_name: - # runs-on: ubuntu-latest - # outputs: - # should_run: ${{ steps.check.outputs.should_run }} - # steps: - # - id: check - # working-directory: . - # run: | - # if [[ "${{ github.event.release.tag_name }}" == v0.0.*-jetbrains ]]; then - # echo "should_run=true" >> $GITHUB_OUTPUT - # else - # echo "should_run=false" >> $GITHUB_OUTPUT - # fi + check_release_name: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + steps: + - id: check + working-directory: . + run: | + if [[ "${{ github.event.release.tag_name }}" == v0.0.*-jetbrains ]]; then + echo "should_run=true" >> $GITHUB_OUTPUT + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi # Prepare and publish the plugin to JetBrains Marketplace repository build: - # needs: check_release_name - # if: needs.check_release_name.outputs.should_run == 'true' + needs: check_release_name + if: needs.check_release_name.outputs.should_run == 'true' name: Build Plugin runs-on: macos-latest permissions: @@ -47,8 +44,8 @@ jobs: # Check out current repository - name: Fetch Sources uses: actions/checkout@v4 - # with: - # ref: ${{ github.event.release.tag_name }} + with: + ref: ${{ github.event.release.tag_name }} - name: Import Apple certificate uses: apple-actions/import-codesign-certs@v3 From f3a74705b86aa550af15eaac7f07cdab55e2fb23 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 15:57:15 -0700 Subject: [PATCH 066/104] publish to both eap and stable --- .github/workflows/jetbrains-release.yaml | 12 +++++++++++- extensions/intellij/build.gradle.kts | 2 +- extensions/intellij/gradle.properties | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 56cd88b16..714796bad 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -175,12 +175,22 @@ jobs: run: ./gradlew buildPlugin # Publish the plugin to JetBrains Marketplace - - name: Publish Plugin + - name: Publish EAP Plugin env: PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} + RELEASE_CHANNEL: eap + run: ./gradlew publishPlugin + + - name: Publish Stable Plugin + env: + PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} + CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} + RELEASE_CHANNEL: default run: ./gradlew publishPlugin # Prepare plugin archive content for creating artifact diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index 8146cb32c..8a0b2363c 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -143,6 +143,6 @@ tasks { // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel - channels.set(listOf("eap", "default")) + channels.set(listOf(environment("RELEASE_CHANNEL").getOrElse("eap"))) } } diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index f5e4edb49..723551552 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -4,7 +4,7 @@ pluginGroup = com.github.continuedev.continueintellijextension pluginName = continue-intellij-extension pluginRepositoryUrl = https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion = 0.0.61 +pluginVersion = 0.0.62 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 223 From 12d910d877cf834c46e65411b8675a894923eb99 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 16:25:20 -0700 Subject: [PATCH 067/104] automatically hide stable versions on release --- .github/workflows/jetbrains-release.yaml | 4 ++-- extensions/intellij/build.gradle.kts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 714796bad..a9cd2e092 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -199,10 +199,10 @@ jobs: shell: bash run: | cd ../../extensions/intellij/build/distributions - echo "Builds:" + echo "Contents of distributions folder:" ls echo "---" - FILENAME=`ls *.zip` + FILENAME=`ls continue-intellij-extension-*.zip` unzip "$FILENAME" -d content echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index 8a0b2363c..ac38ac9fc 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -144,5 +144,8 @@ tasks { // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel channels.set(listOf(environment("RELEASE_CHANNEL").getOrElse("eap"))) + + // We always hide the stable releases until a few days of EAP have proven them stable + hidden = environment("RELEASE_CHANNEL").map { it == "stable" }.getOrElse(false) } } From 746afb23d9d5972828ae402a1f87b1e314b7527f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 16:34:37 -0700 Subject: [PATCH 068/104] cleaner core exit messages --- .../continue/CoreMessenger.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt index 4d4e9f9ba..80ec73b70 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt @@ -235,7 +235,16 @@ class CoreMessenger(private val project: Project, esbuildPath: String, continueC reader = BufferedReader(InputStreamReader(inputStream, StandardCharsets.UTF_8)) process!!.onExit().thenRun { - val err = process?.errorStream?.bufferedReader()?.readText()?.trim() + var err = process?.errorStream?.bufferedReader()?.readText()?.trim() + if (err != null) { + // There are often "⚡️Done in Xms" messages, and we want everything after the last one + val delimiter = "⚡️Done in" + val doneIndex = err.lastIndexOf(delimiter) + if (doneIndex != -1) { + err = err.substring(doneIndex + delimiter.length) + } + } + println("Core process exited with output: $err") ideProtocolClient.showMessage("Core process exited with output: $err") From b90953eaff28deb571984f041b63a5da8f38a204 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 16:40:23 -0700 Subject: [PATCH 069/104] await --- core/config/ConfigHandler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index dff0b065b..a95da2db1 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -51,12 +51,12 @@ class ProfileLifecycleManager { } // Clear saved config and reload - reloadConfig(): Promise { + async reloadConfig(): Promise { this.savedConfig = undefined; this.savedBrowserConfig = undefined; this.pendingConfigPromise = undefined; - return this.profileLoader.doLoadConfig(); + return await this.profileLoader.doLoadConfig(); } async loadConfig( From d56cf555e819a4e96656c1b14b8afa6526484d0e Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 16:47:14 -0700 Subject: [PATCH 070/104] remove testing changes --- .github/workflows/main.yaml | 2 ++ .github/workflows/preview.yaml | 65 +++++++++++++++------------------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3591d3e23..dc5f1019f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -97,10 +97,12 @@ jobs: cd gui npm ci + # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - name: Install Core Dependencies run: | cd core npm ci + npm i vectordb - name: Run core tests run: | diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 5f3fa5ec9..c2abeb9cb 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -1,14 +1,11 @@ name: Publish Preview Extension on: - push: + create: + tags: + - "v0.9.*-vscode" branches: - - nate/fix-ci-tests - # create: - # tags: - # - "v0.9.*-vscode" - # branches: - # - dev + - dev jobs: build: @@ -55,8 +52,8 @@ jobs: with: fetch-depth: 0 # This ensures all tags are fetched - # - name: Checkout tag - # run: git checkout ${GITHUB_REF#refs/tags/} + - name: Checkout tag + run: git checkout ${GITHUB_REF#refs/tags/} # 2. Install npm dependencies - name: Use Node.js from .nvmrc @@ -64,11 +61,11 @@ jobs: with: node-version-file: ".nvmrc" - # - name: Cache extension node_modules - # uses: actions/cache@v3 - # with: - # path: extensions/vscode/node_modules - # key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} + - name: Cache extension node_modules + uses: actions/cache@v3 + with: + path: extensions/vscode/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} - name: Cache core node_modules uses: actions/cache@v3 @@ -76,24 +73,24 @@ jobs: path: core/node_modules key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - # - name: Cache gui node_modules - # uses: actions/cache@v3 - # with: - # path: gui/node_modules - # key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} + - name: Cache gui node_modules + uses: actions/cache@v3 + with: + path: gui/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - # - name: Install extension Dependencies - # run: | - # cd extensions/vscode - # npm ci - # env: - # # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - # GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + - name: Install extension Dependencies + run: | + cd extensions/vscode + npm ci + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - # - name: Install gui Dependencies - # run: | - # cd gui - # npm ci + - name: Install gui Dependencies + run: | + cd gui + npm ci # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - name: Install Core Dependencies @@ -102,16 +99,10 @@ jobs: npm ci npm i vectordb - - name: Install lance - run: | - cd core - npm install @lancedb/vectordb-linux-x64-gnu - if: matrix.os == 'ubuntu-latest' - - name: Run core tests run: | cd core - npm run test -- ./indexing/CodebaseIndexer.test.ts + npm run test env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} From 4da47907f00e08f5de87c2ea940c81c567e865a9 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 19 Aug 2024 16:49:39 -0700 Subject: [PATCH 071/104] fix type error --- core/continueServer/stubs/headers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/continueServer/stubs/headers.ts b/core/continueServer/stubs/headers.ts index e6a864230..ca1e0df9d 100644 --- a/core/continueServer/stubs/headers.ts +++ b/core/continueServer/stubs/headers.ts @@ -6,7 +6,7 @@ export async function getHeaders() { key: constants.c, timestamp: getTimestamp(), v: "1", - extensionVersion: Telemetry.extensionVersion ?? "0.0.0", + extensionVersion: Telemetry.ideInfo?.extensionVersion ?? "0.0.0", os: Telemetry.os ?? "Unknown", uniqueId: Telemetry.uniqueId ?? "None", }; From 41e1eb582bec8676fc973c3a2b76259344fbb317 Mon Sep 17 00:00:00 2001 From: Priyash Patil <38959321+priyashpatil@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:51:03 +0530 Subject: [PATCH 072/104] fix(gui): passing style props on StyledTooltip --- gui/src/components/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gui/src/components/index.tsx b/gui/src/components/index.tsx index a186d0e6b..eac6bf022 100644 --- a/gui/src/components/index.tsx +++ b/gui/src/components/index.tsx @@ -192,7 +192,12 @@ const TooltipStyles = { }; export function StyledTooltip(props: any) { - return ; + const combinedStyles = { + ...TooltipStyles, + ...props.style, // Merge any additional styles passed via props + }; + + return ; } export const TextArea = styled.textarea` From acea620043d2c48826266d4f1f73eaf42819f0c6 Mon Sep 17 00:00:00 2001 From: Priyash Patil <38959321+priyashpatil@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:57:44 +0530 Subject: [PATCH 073/104] fix(core): delete indexed docs if re-indexing --- core/indexing/docs/DocsService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index dbf1910dc..efd679290 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -291,8 +291,8 @@ export default class DocsService { status: "indexing", }; - // Clear old index if re-indexing. - if (reIndex) { + // Delete indexed docs if re-indexing + if (reIndex && await this.has(startUrl.toString())) { console.log("Deleting old embeddings"); await this.delete(startUrl); } From e8add8253a0368bdb63172eafcc2da82df698a27 Mon Sep 17 00:00:00 2001 From: anrgct Date: Tue, 20 Aug 2024 22:20:54 +0800 Subject: [PATCH 074/104] Fix passing codebaseContext parameter and InputToolbar flickering --- core/config/load.ts | 4 ++- gui/src/components/mainInput/TipTapEditor.tsx | 28 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index a9b2ba94f..2bb836d73 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -355,9 +355,11 @@ async function intermediateToFinalConfig( // These context providers are always included, regardless of what, if anything, // the user has configured in config.json + + const codebaseContextParams = ((config.contextProviders || []).filter(isContextProviderWithParams).find(cp => cp.name === "codebase") as ContextProviderWithParams | undefined)?.params || {}; const DEFAULT_CONTEXT_PROVIDERS = [ new FileContextProvider({}), - new CodebaseContextProvider({}), + new CodebaseContextProvider(codebaseContextParams), ]; const DEFAULT_CONTEXT_PROVIDERS_TITLES = DEFAULT_CONTEXT_PROVIDERS.map( diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 8ab8f190e..83752c95f 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -56,6 +56,7 @@ import { getSlashCommandDropdownOptions, } from "./getSuggestion"; import { ComboBoxItem } from "./types"; +import { debounce } from "lodash"; const InputBoxDiv = styled.div` resize: none; @@ -473,6 +474,31 @@ function TipTapEditor(props: TipTapEditorProps) { }, }); + const [shouldHideToolbar, setShouldHideToolbar] = useState(false); + const debouncedShouldHideToolbar = debounce((value) => { + setShouldHideToolbar(value); + }, 200); + + useEffect(() => { + if (editor) { + const handleFocus = () => { + debouncedShouldHideToolbar(false); + } + + const handleBlur = () => { + debouncedShouldHideToolbar(true); + }; + + editor.on('focus', handleFocus); + editor.on('blur', handleBlur); + + return () => { + editor.off('focus', handleFocus); + editor.off('blur', handleBlur); + }; + } + }, [editor]); + const editorFocusedRef = useUpdatingRef(editor?.isFocused, [editor]); useEffect(() => { @@ -831,7 +857,7 @@ function TipTapEditor(props: TipTapEditorProps) { />