From b5705c1d5fc0103b7ab849855cd8b90041551ff1 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 9 Jan 2025 10:10:24 +0000 Subject: [PATCH 001/111] docs/getDetails --- core/core.ts | 3 + core/index.d.ts | 8 + core/indexing/docs/DocsService.ts | 108 ++++++++--- core/protocol/core.ts | 3 +- core/protocol/passThrough.ts | 1 + .../toolWindow/ContinueBrowser.kt | 1 + .../components/indexing/DocsDetailsDialog.tsx | 176 ++++++++++++++++++ .../indexing/DocsIndexingStatus.tsx | 26 ++- gui/src/index.css | 10 + 9 files changed, 305 insertions(+), 31 deletions(-) create mode 100644 gui/src/components/indexing/DocsDetailsDialog.tsx diff --git a/core/core.ts b/core/core.ts index af05f7d96..8122636dd 100644 --- a/core/core.ts +++ b/core/core.ts @@ -843,6 +843,9 @@ export class Core { on("docs/initStatuses", async (msg) => { void this.docsService.initStatuses(); }); + on("docs/getDetails", async (msg) => { + return await this.docsService.getDetails(msg.data.startUrl); + }); // on("didChangeSelectedProfile", (msg) => { diff --git a/core/index.d.ts b/core/index.d.ts index e4f3ff143..bbdc02658 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -231,6 +231,14 @@ export interface SiteIndexingConfig { maxDepth?: number; } +export interface DocsIndexingDetails { + startUrl: string; + config: SiteIndexingConfig; + indexingStatus: IndexingStatus | undefined; + chunks: Chunk[]; + isPreIndexedDoc: boolean; +} + export interface IContextProvider { get description(): ContextProviderDescription; diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 1f56de495..0bed5571e 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -5,6 +5,7 @@ import lancedb, { Connection } from "vectordb"; import { Chunk, ContinueConfig, + DocsIndexingDetails, IDE, IdeInfo, ILLM, @@ -322,7 +323,7 @@ export default class DocsService { } // Returns true if startUrl has been indexed with current embeddingsProvider - async hasMetadata(startUrl: string): Promise> { + async hasMetadata(startUrl: string): Promise { const db = await this.getOrCreateSqliteDb(); const title = await db.get( `SELECT title FROM ${DocsService.sqlitebTableName} WHERE startUrl = ? AND embeddingsProviderId = ?`, @@ -660,6 +661,64 @@ export default class DocsService { return await this.retrieveChunks(startUrl, vector, nRetrieve); } + private lanceDBRowToChunk(row: LanceDbDocsRow): Chunk { + return { + digest: row.path, + filepath: row.path, + startLine: row.startline, + endLine: row.endline, + index: 0, + content: row.content, + otherMetadata: { + title: row.title, + }, + }; + } + async getDetails(startUrl: string): Promise { + const db = await this.getOrCreateSqliteDb(); + + try { + const preIndexedDoc = preIndexedDocs[startUrl]; + const isPreIndexedDoc = !!preIndexedDoc; + + const embeddingsProvider = + await this.getEmbeddingsProvider(isPreIndexedDoc); + const result = await db.get( + `SELECT startUrl, title, favicon FROM ${DocsService.sqlitebTableName} WHERE startUrl = ? AND embeddingsProviderId = ?`, + startUrl, + embeddingsProvider.embeddingId, + ); + + if (!result) { + throw new Error(`${startUrl} not found in sqlite`); + } + const siteIndexingConfig: SiteIndexingConfig = { + startUrl, + faviconUrl: result.favicon, + title: result.title, + }; + + const table = await this.getOrCreateLanceTable({ + initializationVector: [], + isPreIndexedDoc, + }); + const rows = (await table + .filter(`starturl = '${startUrl}'`) + .limit(1000) + .execute()) as LanceDbDocsRow[]; + + return { + startUrl, + config: siteIndexingConfig, + indexingStatus: this.statuses.get(startUrl), + chunks: rows.map(this.lanceDBRowToChunk), + isPreIndexedDoc, + }; + } catch (e) { + console.warn("Error getting details", e); + throw e; + } + } // This is split into its own function so that it can be recursive // in the case of fetching preindexed docs from s3 async retrieveChunks( @@ -703,17 +762,7 @@ export default class DocsService { }); } - return docs.map((doc) => ({ - digest: doc.path, - filepath: doc.path, - startLine: doc.startline, - endLine: doc.endline, - index: 0, - content: doc.content, - otherMetadata: { - title: doc.title, - }, - })); + return docs.map(this.lanceDBRowToChunk); } // SQLITE DB @@ -769,7 +818,7 @@ export default class DocsService { private async syncDocs( oldConfig: ContinueConfig | undefined, newConfig: ContinueConfig, - reindex: boolean, + forceReindex: boolean, ) { try { this.isSyncing = true; @@ -812,20 +861,25 @@ export default class DocsService { ) { changedDocs.push(doc); } else { - // if get's here, not changed, no update needed, mark as complete - this.handleStatusUpdate({ - type: "docs", - id: doc.startUrl, - embeddingsProviderId: this.config.embeddingsProvider.embeddingId, - isReindexing: false, - title: doc.title, - debugInfo: "Config sync: not changed", - icon: doc.faviconUrl, - url: doc.startUrl, - progress: 1, - description: "Complete", - status: "complete", - }); + if (forceReindex) { + changedDocs.push(doc); + } else { + // if get's here, not changed, no update needed, mark as complete + this.handleStatusUpdate({ + type: "docs", + id: doc.startUrl, + embeddingsProviderId: + this.config.embeddingsProvider.embeddingId, + isReindexing: false, + title: doc.title, + debugInfo: "Config sync: not changed", + icon: doc.faviconUrl, + url: doc.startUrl, + progress: 1, + description: "Complete", + status: "complete", + }); + } } } else { newDocs.push(doc); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 9495dc3b2..63474514f 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -9,6 +9,7 @@ import type { ContextProviderWithParams, ContextSubmenuItem, DiffLine, + DocsIndexingDetails, FileSymbolMap, IdeSettings, LLMFullCompletionOptions, @@ -201,7 +202,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { "indexing/setPaused": [{ type: string; id: string; paused: boolean }, void]; "docs/getSuggestedDocs": [undefined, void]; "docs/initStatuses": [undefined, void]; - + "docs/getDetails": [{ startUrl: string }, DocsIndexingDetails]; addAutocompleteModel: [{ model: ModelDescription }, void]; "profiles/switch": [{ id: string }, undefined]; diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 756b3db54..c7f6822bf 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -52,6 +52,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "indexing/setPaused", "docs/getSuggestedDocs", "docs/initStatuses", + "docs/getDetails", // "completeOnboarding", "addAutocompleteModel", diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt index 5523bdeff..c670ec862 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt @@ -62,6 +62,7 @@ class ContinueBrowser(val project: Project, url: String) { "indexing/setPaused", "docs/getSuggestedDocs", "docs/initStatuses", + "docs/getDetails", // "completeOnboarding", "addAutocompleteModel", diff --git a/gui/src/components/indexing/DocsDetailsDialog.tsx b/gui/src/components/indexing/DocsDetailsDialog.tsx new file mode 100644 index 000000000..7b824291a --- /dev/null +++ b/gui/src/components/indexing/DocsDetailsDialog.tsx @@ -0,0 +1,176 @@ +import { + CheckIcon, + InformationCircleIcon, + PencilIcon, + PlusIcon, +} from "@heroicons/react/24/outline"; +import { + DocsIndexingDetails, + IndexingStatus, + PackageDocsResult, + SiteIndexingConfig, +} from "core"; +import preIndexedDocs from "core/indexing/docs/preIndexedDocs"; +import { usePostHog } from "posthog-js/react"; +import { + useCallback, + useContext, + useEffect, + useLayoutEffect, + useMemo, + useRef, + useState, +} from "react"; +import { useDispatch } from "react-redux"; +import { Input, SecondaryButton } from ".."; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { useAppSelector } from "../../redux/hooks"; +import { updateConfig } from "../../redux/slices/configSlice"; +import { updateIndexingStatus } from "../../redux/slices/indexingSlice"; +import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; +import FileIcon from "../FileIcon"; +import { ToolTip } from "../gui/Tooltip"; +import DocsIndexingPeeks from "../indexing/DocsIndexingPeeks"; +import { Tooltip } from "react-tooltip"; + +interface DocsDetailsDialogProps { + startUrl: string; +} +function DocsDetailsDialog({ startUrl }: DocsDetailsDialogProps) { + const config = useAppSelector((store) => store.config.config); + const posthog = usePostHog(); + const dispatch = useDispatch(); + + const ideMessenger = useContext(IdeMessengerContext); + + const closeDialog = () => { + dispatch(setShowDialog(false)); + dispatch(setDialogMessage(undefined)); + }; + + const [isLoading, setIsLoading] = useState(false); + const [isError, setIsError] = useState(false); + const [data, setData] = useState(undefined); + + const fetchData = useCallback(async () => { + setIsLoading(true); + setIsError(false); + + try { + const response = await ideMessenger.request("docs/getDetails", { + startUrl, + }); + if (response.status === "error") { + throw new Error(response.error); + } + setData(response.content); + } catch (error) { + setIsError(true); + } finally { + setIsLoading(false); + } + }, []); + + useEffect(() => { + fetchData(); + }, []); + + let comp =
Loading...
; + if (!isLoading) { + if (isError) { + comp = ( +
+
Error fetching docs details
+ Try again +
+ ); + } + if (data) { + comp = ( +
+

{`Title: ${data.config.title}`}

+

{`Pre-indexed doc: ${data.isPreIndexedDoc}`}

+ {!data.chunks?.length ? ( +
No article chunks
+ ) : ( +
+ + + + + + + + + {data.chunks.map((chunk, i) => { + const contentToolTipId = `docs-content-peek-${i}`; + const urlToolTipId = `docs-url-peek-${i}`; + return ( + <> + + + + + + {chunk.filepath} + + + {chunk.content} + + + ); + })} + +
FilepathContent
+ + {chunk.filepath} + + + + {chunk.content} + +
+
+ )} +
+ ); + } + } + + return ( +
+

Docs index

+

{ + e.stopPropagation(); + ideMessenger.post("openUrl", startUrl); + }} + > + {startUrl} +

+ {comp} +
+ Close +
+
+ ); +} + +export default DocsDetailsDialog; diff --git a/gui/src/components/indexing/DocsIndexingStatus.tsx b/gui/src/components/indexing/DocsIndexingStatus.tsx index 9fbd0f9fe..125bb202b 100644 --- a/gui/src/components/indexing/DocsIndexingStatus.tsx +++ b/gui/src/components/indexing/DocsIndexingStatus.tsx @@ -6,6 +6,7 @@ import { ArrowTopRightOnSquareIcon, CheckCircleIcon, ExclamationTriangleIcon, + EyeIcon, PauseCircleIcon, TrashIcon, } from "@heroicons/react/24/outline"; @@ -13,6 +14,7 @@ import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { updateIndexingStatus } from "../../redux/slices/indexingSlice"; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; import ConfirmationDialog from "../dialogs/ConfirmationDialog"; +import DocsDetailsDialog from "./DocsDetailsDialog"; interface IndexingStatusViewerProps { docConfig: SiteIndexingConfig; @@ -173,9 +175,27 @@ function DocsIndexingStatus({ docConfig }: IndexingStatusViewerProps) { }[status?.status]} - - {status?.description} - +
+ + {status?.description} + + {process.env.NODE_ENV === "development" && + status?.status === "complete" ? ( + { + dispatch(setShowDialog(true)); + dispatch( + setDialogMessage( + , + ), + ); + }} + > + Add Docs + + ) : null} +
); diff --git a/gui/src/index.css b/gui/src/index.css index ba8454b7b..93ccd384f 100644 --- a/gui/src/index.css +++ b/gui/src/index.css @@ -92,3 +92,13 @@ body { -webkit-line-clamp: 1; -webkit-box-orient: vertical; } + +.truncate-start { + display: inline-block; + vertical-align: middle; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + direction: rtl; + width: 100%; +} From 8a71cc603288f7badb4b82521c19fc22b2d30165 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 9 Jan 2025 11:41:52 +0000 Subject: [PATCH 002/111] docs crawler logging --- core/context/providers/DocsContextProvider.ts | 1 + core/indexing/docs/DocsCrawler.ts | 15 +++++++++------ gui/src/components/mainInput/resolveInput.ts | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index 9ee50c256..0d296c71d 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -88,6 +88,7 @@ class DocsContextProvider extends BaseContextProvider { } await docsService.isInitialized; + console.log("DOCS REQUEST", extras.fullInput, query); // Get chunks let chunks = await docsService.retrieveChunksFromQuery( extras.fullInput, // confusing: fullInput = the query, query = startUrl in this case diff --git a/core/indexing/docs/DocsCrawler.ts b/core/indexing/docs/DocsCrawler.ts index 8854d8e87..d8a13e80f 100644 --- a/core/indexing/docs/DocsCrawler.ts +++ b/core/indexing/docs/DocsCrawler.ts @@ -39,11 +39,13 @@ class DocsCrawler { maxRequestsPerCrawl: number = this.MAX_REQUESTS_PER_CRAWL, ): AsyncGenerator { if (startUrl.host === this.GITHUB_HOST) { + console.log("GITHUB DETECTED: Using Github"); yield* new GitHubCrawler(startUrl).crawl(); return; } try { + console.log(`Crawling ${startUrl.toString()}: Trying default crawler`); const pageData = await new DefaultCrawler(startUrl).crawl(); if (pageData.length > 0) { yield* pageData; @@ -54,9 +56,11 @@ class DocsCrawler { } if (this.shouldUseChromium()) { + console.log(`Crawling ${startUrl.toString()}: Trying chromium crawler`); yield* new ChromiumCrawler(startUrl, maxRequestsPerCrawl).crawl(); } else { let didCrawlSinglePage = false; + console.log(`Crawling ${startUrl.toString()}: Trying cheerio crawler`); for await (const pageData of new CheerioCrawler( startUrl, @@ -73,6 +77,10 @@ class DocsCrawler { this.chromiumInstaller.shouldProposeUseChromiumOnCrawlFailure(); if (shouldProposeUseChromium) { + console.log( + `Crawling ${startUrl.toString()}: Cheerio failed: proposing chromium crawler`, + ); + const didInstall = await this.chromiumInstaller.proposeAndAttemptInstall( startUrl.toString(), @@ -92,9 +100,4 @@ class DocsCrawler { } export default DocsCrawler; -export { - CheerioCrawler, - ChromiumCrawler, - ChromiumInstaller, - GitHubCrawler, -}; +export { CheerioCrawler, ChromiumCrawler, ChromiumInstaller, GitHubCrawler }; diff --git a/gui/src/components/mainInput/resolveInput.ts b/gui/src/components/mainInput/resolveInput.ts index 535a3074f..1707dfe21 100644 --- a/gui/src/components/mainInput/resolveInput.ts +++ b/gui/src/components/mainInput/resolveInput.ts @@ -128,7 +128,9 @@ async function resolveEditorContent({ selectedCode, selectedModelTitle, }); + console.log(item, stripImages(parts)); if (result.status === "success") { + console.log("SUCCESS", result); const resolvedItems = result.content; contextItems.push(...resolvedItems); for (const resolvedItem of resolvedItems) { @@ -238,7 +240,7 @@ function resolveParagraph( export function hasSlashCommandOrContextProvider( editorState: JSONContent, ): boolean { - if (!editorState.content) { + if (!editorState?.content) { return false; } From d6051f307c07835b6e9270a09a6eb1db13a927bf Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 9 Jan 2025 16:34:37 -0800 Subject: [PATCH 003/111] minor mentionlist updates --- core/context/providers/DocsContextProvider.ts | 6 ++++-- gui/src/components/mainInput/AddCodeToEditExtension.ts | 2 +- gui/src/components/mainInput/MentionExtension.ts | 3 ++- gui/src/components/mainInput/resolveInput.ts | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index 0d296c71d..d014b4b9a 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -20,6 +20,7 @@ class DocsContextProvider extends BaseContextProvider { displayTitle: "Docs", description: "Type to search docs", type: "submenu", + renderInlineAs: "", }; constructor(options: any) { @@ -80,6 +81,8 @@ class DocsContextProvider extends BaseContextProvider { query: string, extras: ContextProviderExtras, ): Promise { + const nRetrieve = this.options?.nRetrieve ?? DocsContextProvider.nRetrieve; + // Get docs service const docsService = DocsService.getSingleton(); if (!docsService) { @@ -88,12 +91,11 @@ class DocsContextProvider extends BaseContextProvider { } await docsService.isInitialized; - console.log("DOCS REQUEST", extras.fullInput, query); // Get chunks let chunks = await docsService.retrieveChunksFromQuery( extras.fullInput, // confusing: fullInput = the query, query = startUrl in this case query, - this.options?.nRetrieve ?? DocsContextProvider.nRetrieve, + nRetrieve, ); if (!chunks?.length) { return []; diff --git a/gui/src/components/mainInput/AddCodeToEditExtension.ts b/gui/src/components/mainInput/AddCodeToEditExtension.ts index 795b7a2e4..f633c342b 100644 --- a/gui/src/components/mainInput/AddCodeToEditExtension.ts +++ b/gui/src/components/mainInput/AddCodeToEditExtension.ts @@ -89,7 +89,7 @@ export const AddCodeToEdit = Node.create({ default: null, parseHTML: (element) => element.getAttribute("data-renderInlineAs"), renderHTML: (attributes) => { - if (!attributes.renderInlineAs) { + if (typeof attributes.renderInlineAs !== "string") { return {}; } diff --git a/gui/src/components/mainInput/MentionExtension.ts b/gui/src/components/mainInput/MentionExtension.ts index 71d282d46..b17f2ee76 100644 --- a/gui/src/components/mainInput/MentionExtension.ts +++ b/gui/src/components/mainInput/MentionExtension.ts @@ -31,6 +31,7 @@ export const Mention = Node.create({ char: "@", pluginKey: MentionPluginKey, command: ({ editor, range, props }) => { + console.log(props); // increase range.to by one when the next node is of type "text" // and starts with a space character const nodeAfter = editor.view.state.selection.$to.nodeAfter; @@ -116,7 +117,7 @@ export const Mention = Node.create({ default: null, parseHTML: (element) => element.getAttribute("data-renderInlineAs"), renderHTML: (attributes) => { - if (!attributes.renderInlineAs) { + if (typeof attributes.renderInlineAs !== "string") { return {}; } diff --git a/gui/src/components/mainInput/resolveInput.ts b/gui/src/components/mainInput/resolveInput.ts index 1707dfe21..ae1a97cea 100644 --- a/gui/src/components/mainInput/resolveInput.ts +++ b/gui/src/components/mainInput/resolveInput.ts @@ -52,7 +52,7 @@ async function resolveEditorContent({ for (const p of editorState.content) { if (p.type === "paragraph") { const [text, ctxItems, foundSlashCommand] = resolveParagraph(p); - + console.log("PARAGRAPH RESOLVE", ctxItems); // Only take the first slash command\ if (foundSlashCommand && typeof slashCommand === "undefined") { slashCommand = foundSlashCommand; @@ -128,9 +128,7 @@ async function resolveEditorContent({ selectedCode, selectedModelTitle, }); - console.log(item, stripImages(parts)); if (result.status === "success") { - console.log("SUCCESS", result); const resolvedItems = result.content; contextItems.push(...resolvedItems); for (const resolvedItem of resolvedItems) { @@ -139,6 +137,7 @@ async function resolveEditorContent({ } } + console.log(stripImages(parts), contextItems); // cmd+enter to use codebase if (modifiers.useCodebase) { const result = await ideMessenger.request("context/getContextItems", { @@ -219,6 +218,7 @@ function resolveParagraph( if (child.type === "text") { text += text === "" ? child.text?.trimStart() : child.text; } else if (child.type === "mention") { + console.log("CHILD", child); text += typeof child.attrs?.renderInlineAs === "string" ? child.attrs.renderInlineAs From 4ab97a1aa9351c9e482d58e3fc1031b7260a0d76 Mon Sep 17 00:00:00 2001 From: IqbalLx Date: Mon, 13 Jan 2025 19:11:56 +0700 Subject: [PATCH 004/111] chore: remove deprecated and add new llama3.3 --- binary/package-lock.json | 1 + core/llm/llms/Groq.ts | 5 +---- extensions/vscode/package-lock.json | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/binary/package-lock.json b/binary/package-lock.json index c026c940c..158342e0b 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -118,6 +118,7 @@ "@types/jest": "^29.5.12", "@types/jquery": "^3.5.29", "@types/jsdom": "^21.1.6", + "@types/json-schema": "^7.0.15", "@types/mozilla-readability": "^0.2.1", "@types/mustache": "^4.2.5", "@types/node-fetch": "^2.6.11", diff --git a/core/llm/llms/Groq.ts b/core/llm/llms/Groq.ts index cf26f993c..3585e73d8 100644 --- a/core/llm/llms/Groq.ts +++ b/core/llm/llms/Groq.ts @@ -10,19 +10,16 @@ class Groq extends OpenAI { maxStopWords: number | undefined = 4; private static modelConversion: { [key: string]: string } = { - "llama2-70b": "llama2-70b-4096", "mistral-8x7b": "mixtral-8x7b-32768", - gemma: "gemma-7b-it", gemma2: "gemma2-9b-it", "llama3-8b": "llama3-8b-8192", "llama3-70b": "llama3-70b-8192", "llama3.1-8b": "llama-3.1-8b-instant", - "llama3.1-70b": "llama-3.1-70b-versatile", - "llama3.1-405b": "llama-3.1-405b-reasoning", "llama3.2-1b": "llama-3.2-1b-preview", "llama3.2-3b": "llama-3.2-3b-preview", "llama3.2-11b": "llama-3.2-11b-vision-preview", "llama3.2-90b": "llama-3.2-90b-vision-preview", + "llama3.3-70b": "llama-3.3-70b-versatile", }; protected _convertModelName(model: string): string { return Groq.modelConversion[model] ?? model; diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 110229e03..26d319d83 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.250", + "version": "0.9.251", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.250", + "version": "0.9.251", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", From fe231a23a31e4d6f3f2b18f2554e17e9c21f27b2 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 14 Jan 2025 18:36:23 -0800 Subject: [PATCH 005/111] replace trash context provider icon --- gui/src/components/mainInput/MentionList.tsx | 537 +++++++++--------- gui/src/components/mainInput/getSuggestion.ts | 2 +- 2 files changed, 272 insertions(+), 267 deletions(-) diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index aae963779..194f7415e 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -71,6 +71,7 @@ const ICONS_FOR_DROPDOWN: { [key: string]: any } = { debugger: BugAntIcon, os: CpuChipIcon, tree: Bars3BottomLeftIcon, + trash: TrashIcon, "prompt-files": DocumentTextIcon, "repo-map": FolderIcon, "/clear": TrashIcon, @@ -189,294 +190,298 @@ interface MentionListProps { onClose: () => void; } -const MentionList = forwardRef((props: MentionListProps, ref) => { - const dispatch = useDispatch(); +export const MentionList = forwardRef( + (props: MentionListProps, ref) => { + const dispatch = useDispatch(); - const ideMessenger = useContext(IdeMessengerContext); + const ideMessenger = useContext(IdeMessengerContext); - const [selectedIndex, setSelectedIndex] = useState(0); + const [selectedIndex, setSelectedIndex] = useState(0); - const [subMenuTitle, setSubMenuTitle] = useState( - undefined, - ); - const [querySubmenuItem, setQuerySubmenuItem] = useState< - ComboBoxItem | undefined - >(undefined); + const [subMenuTitle, setSubMenuTitle] = useState( + undefined, + ); + const [querySubmenuItem, setQuerySubmenuItem] = useState< + ComboBoxItem | undefined + >(undefined); - const [allItems, setAllItems] = useState([]); + const [allItems, setAllItems] = useState([]); - useEffect(() => { - const items = [...props.items]; - if (subMenuTitle === "Type to search docs") { - items.push({ - title: "Add Docs", - type: "action", - action: () => { - dispatch(setShowDialog(true)); - dispatch(setDialogMessage()); + useEffect(() => { + const items = [...props.items]; + if (subMenuTitle === "Type to search docs") { + items.push({ + title: "Add Docs", + type: "action", + action: () => { + dispatch(setShowDialog(true)); + dispatch(setDialogMessage()); - // Delete back to last '@' - const { tr } = props.editor.view.state; - const text = tr.doc.textBetween(0, tr.selection.from); - const start = text.lastIndexOf("@"); - props.editor.view.dispatch( - tr.delete(start, tr.selection.from).scrollIntoView(), - ); - }, - description: "Add a new documentation source", - }); - } else if (subMenuTitle === ".prompt files") { - items.push({ - title: "New .prompt file", - type: "action", - action: () => { - ideMessenger.post("config/newPromptFile", undefined); - const { tr } = props.editor.view.state; - const text = tr.doc.textBetween(0, tr.selection.from); - const start = text.lastIndexOf("@"); - if (start !== -1) { + // Delete back to last '@' + const { tr } = props.editor.view.state; + const text = tr.doc.textBetween(0, tr.selection.from); + const start = text.lastIndexOf("@"); props.editor.view.dispatch( tr.delete(start, tr.selection.from).scrollIntoView(), ); - } - props.onClose(); // Escape the mention list after creating a new prompt file - }, - description: "Create a new .prompt file", + }, + description: "Add a new documentation source", + }); + } else if (subMenuTitle === ".prompt files") { + items.push({ + title: "New .prompt file", + type: "action", + action: () => { + ideMessenger.post("config/newPromptFile", undefined); + const { tr } = props.editor.view.state; + const text = tr.doc.textBetween(0, tr.selection.from); + const start = text.lastIndexOf("@"); + if (start !== -1) { + props.editor.view.dispatch( + tr.delete(start, tr.selection.from).scrollIntoView(), + ); + } + props.onClose(); // Escape the mention list after creating a new prompt file + }, + description: "Create a new .prompt file", + }); + } + + setAllItems(items); + }, [subMenuTitle, props.items, props.editor]); + + const queryInputRef = useRef(null); + + useEffect(() => { + if (queryInputRef.current) { + queryInputRef.current.focus(); + } + }, [querySubmenuItem]); + + const selectItem = (index: number) => { + const item = allItems[index]; + + if (item.type === "action" && item.action) { + item.action(); + return; + } + + if ( + item.type === "contextProvider" && + item.contextProvider?.type === "submenu" + ) { + setSubMenuTitle(item.description); + if (item.id) { + props.enterSubmenu?.(props.editor, item.id); + } + return; + } + + if (item.contextProvider?.type === "query") { + // update editor to complete context provider title + const { tr } = props.editor.view.state; + const text = tr.doc.textBetween(0, tr.selection.from); + const partialText = text.slice(text.lastIndexOf("@") + 1); + const remainingText = item.title.slice(partialText.length); + props.editor.view.dispatch( + tr.insertText(remainingText, tr.selection.from), + ); + + setSubMenuTitle(item.description); + setQuerySubmenuItem(item); + return; + } + + if (item) { + props.command({ ...item, itemType: item.type }); + } + }; + + const totalItems = allItems.length; + + const itemRefs = useRef>([]); + + const upHandler = () => { + setSelectedIndex((prevIndex) => { + const newIndex = prevIndex - 1 >= 0 ? prevIndex - 1 : 0; + itemRefs.current[newIndex]?.scrollIntoView({ + behavior: "instant" as ScrollBehavior, + block: "nearest", + }); + return newIndex; }); - } + }; - setAllItems(items); - }, [subMenuTitle, props.items, props.editor]); - - const queryInputRef = useRef(null); - - useEffect(() => { - if (queryInputRef.current) { - queryInputRef.current.focus(); - } - }, [querySubmenuItem]); - - const selectItem = (index: number) => { - const item = allItems[index]; - - if (item.type === "action" && item.action) { - item.action(); - return; - } - - if ( - item.type === "contextProvider" && - item.contextProvider?.type === "submenu" - ) { - setSubMenuTitle(item.description); - if (item.id) { - props.enterSubmenu?.(props.editor, item.id); - } - return; - } - - if (item.contextProvider?.type === "query") { - // update editor to complete context provider title - const { tr } = props.editor.view.state; - const text = tr.doc.textBetween(0, tr.selection.from); - const partialText = text.slice(text.lastIndexOf("@") + 1); - const remainingText = item.title.slice(partialText.length); - props.editor.view.dispatch( - tr.insertText(remainingText, tr.selection.from), - ); - - setSubMenuTitle(item.description); - setQuerySubmenuItem(item); - return; - } - - if (item) { - props.command({ ...item, itemType: item.type }); - } - }; - - const totalItems = allItems.length; - - const itemRefs = useRef>([]); - - const upHandler = () => { - setSelectedIndex((prevIndex) => { - const newIndex = prevIndex - 1 >= 0 ? prevIndex - 1 : 0; - itemRefs.current[newIndex]?.scrollIntoView({ - behavior: "instant" as ScrollBehavior, - block: "nearest", + const downHandler = () => { + setSelectedIndex((prevIndex) => { + const newIndex = prevIndex + 1 < totalItems ? prevIndex + 1 : prevIndex; + itemRefs.current[newIndex]?.scrollIntoView({ + behavior: "instant" as ScrollBehavior, + block: "nearest", + }); + return newIndex; }); - return newIndex; - }); - }; + }; - const downHandler = () => { - setSelectedIndex((prevIndex) => { - const newIndex = prevIndex + 1 < totalItems ? prevIndex + 1 : prevIndex; - itemRefs.current[newIndex]?.scrollIntoView({ - behavior: "instant" as ScrollBehavior, - block: "nearest", - }); - return newIndex; - }); - }; + const enterHandler = () => { + selectItem(selectedIndex); + }; - const enterHandler = () => { - selectItem(selectedIndex); - }; + useEffect(() => setSelectedIndex(0), [allItems]); - useEffect(() => setSelectedIndex(0), [allItems]); - - useImperativeHandle(ref, () => ({ - onKeyDown: ({ event }: { event: KeyboardEvent }) => { - if (event.key === "ArrowUp") { - upHandler(); - return true; - } - - if (event.key === "ArrowDown") { - downHandler(); - return true; - } - - if (event.key === "Enter" || event.key === "Tab") { - enterHandler(); - event.stopPropagation(); - event.preventDefault(); - return true; - } - - if (event.key === "Escape") { - event.preventDefault(); - event.stopPropagation(); - return true; - } - - if (event.key === " ") { - if (allItems.length === 1) { - enterHandler(); + useImperativeHandle(ref, () => ({ + onKeyDown: ({ event }: { event: KeyboardEvent }) => { + if (event.key === "ArrowUp") { + upHandler(); return true; } - } - return false; - }, - })); + if (event.key === "ArrowDown") { + downHandler(); + return true; + } - const showFileIconForItem = (item: ComboBoxItem) => { - return ["file", "code"].includes(item.type); - }; + if (event.key === "Enter" || event.key === "Tab") { + enterHandler(); + event.stopPropagation(); + event.preventDefault(); + return true; + } - useEffect(() => { - itemRefs.current = itemRefs.current.slice(0, allItems.length); - }, [allItems]); + if (event.key === "Escape") { + event.preventDefault(); + event.stopPropagation(); + return true; + } - return ( - - {querySubmenuItem ? ( - { - if (!queryInputRef.current) { - return; - } - if (e.key === "Enter") { - if (e.shiftKey) { - queryInputRef.current.innerText += "\n"; - } else { - props.command({ - ...querySubmenuItem, - itemType: querySubmenuItem.type, - query: queryInputRef.current.value, - label: `${querySubmenuItem.label}: ${queryInputRef.current.value}`, - }); + if (event.key === " ") { + if (allItems.length === 1) { + enterHandler(); + return true; + } + } + + return false; + }, + })); + + const showFileIconForItem = (item: ComboBoxItem) => { + return ["file", "code"].includes(item.type); + }; + + useEffect(() => { + itemRefs.current = itemRefs.current.slice(0, allItems.length); + }, [allItems]); + + return ( + + {querySubmenuItem ? ( + { + if (!queryInputRef.current) { + return; } - } else if (e.key === "Escape") { - setQuerySubmenuItem(undefined); - setSubMenuTitle(undefined); - } - }} - /> - ) : ( - <> - {subMenuTitle && {subMenuTitle}} - {allItems.length ? ( - allItems.map((item, index) => ( - (itemRefs.current[index] = el)} - className={`item ${ - index === selectedIndex ? "is-selected" : "" - }`} - key={index} - onClick={() => selectItem(index)} - onMouseEnter={() => setSelectedIndex(index)} - > - -
- {showFileIconForItem(item) && ( - - )} - {!showFileIconForItem(item) && ( - <> - - - )} - {item.title} - {" "} -
- - {item.description} - {item.type === "contextProvider" && - item.contextProvider?.type === "submenu" && ( - + ) : ( + <> + {subMenuTitle && {subMenuTitle}} + {allItems.length ? ( + allItems.map((item, index) => ( + (itemRefs.current[index] = el)} + className={`item ${ + index === selectedIndex ? "is-selected" : "" + }`} + key={index} + onClick={() => selectItem(index)} + onMouseEnter={() => setSelectedIndex(index)} + > + +
+ {showFileIconForItem(item) && ( + )} - {item.subActions?.map((subAction) => { - const Icon = ICONS_FOR_DROPDOWN[subAction.icon]; - return ( - { - subAction.action(item); - e.stopPropagation(); - e.preventDefault(); - props.onClose(); - }} - text={undefined} - > - - - ); - })} + {!showFileIconForItem(item) && ( + <> + + + )} + {item.title} + {" "} +
+ + {item.description} + {item.type === "contextProvider" && + item.contextProvider?.type === "submenu" && ( + + )} + {item.subActions?.map((subAction) => { + const Icon = getIconFromDropdownItem( + subAction.icon, + "action", + ); + return ( + { + subAction.action(item); + e.stopPropagation(); + e.preventDefault(); + props.onClose(); + }} + text={undefined} + > + + + ); + })} +
-
-
- )) - ) : ( - No results - )} - {/* */} - - )} -
- ); -}); -export default MentionList; + + )) + ) : ( + No results + )} + {/* */} + + )} +
+ ); + }, +); diff --git a/gui/src/components/mainInput/getSuggestion.ts b/gui/src/components/mainInput/getSuggestion.ts index ecc7b835e..4d3590c19 100644 --- a/gui/src/components/mainInput/getSuggestion.ts +++ b/gui/src/components/mainInput/getSuggestion.ts @@ -7,7 +7,7 @@ import { import { MutableRefObject } from "react"; import tippy from "tippy.js"; import { IIdeMessenger } from "../../context/IdeMessenger"; -import MentionList from "./MentionList"; +import { MentionList } from "./MentionList"; import { ComboBoxItem, ComboBoxItemType, ComboBoxSubAction } from "./types"; import { TIPPY_DIV_ID } from "./TipTapEditor"; From 8c49bd8e848fe85c72e058fa660e788c452add8d Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 15 Jan 2025 08:50:38 -0800 Subject: [PATCH 006/111] docs comment --- core/context/providers/DocsContextProvider.ts | 5 ++++- core/indexing/docs/crawlers/GithubCrawler.test.ts | 0 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 core/indexing/docs/crawlers/GithubCrawler.test.ts diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index dcc5000b7..5d79f989f 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -20,7 +20,10 @@ class DocsContextProvider extends BaseContextProvider { displayTitle: "Docs", description: "Type to search docs", type: "submenu", - renderInlineAs: "", + // Todo: consider a different renderInline so that when multiple docs are referenced in one message, + // Or the doc has an odd name unrelated to the content + // The name of the doc itself doesn't skew the embedding results + // renderInlineAs: "", }; constructor(options: any) { diff --git a/core/indexing/docs/crawlers/GithubCrawler.test.ts b/core/indexing/docs/crawlers/GithubCrawler.test.ts new file mode 100644 index 000000000..e69de29bb From c837378c2ef591cd0ef3da1b4bede3141b36d535 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 15 Jan 2025 09:07:53 -0800 Subject: [PATCH 007/111] cleanup --- core/indexing/docs/DocsCrawler.ts | 8 -------- core/indexing/docs/crawlers/GithubCrawler.test.ts | 0 gui/src/components/mainInput/MentionExtension.ts | 1 - gui/src/components/mainInput/resolveInput.ts | 3 --- 4 files changed, 12 deletions(-) delete mode 100644 core/indexing/docs/crawlers/GithubCrawler.test.ts diff --git a/core/indexing/docs/DocsCrawler.ts b/core/indexing/docs/DocsCrawler.ts index d8a13e80f..24f937019 100644 --- a/core/indexing/docs/DocsCrawler.ts +++ b/core/indexing/docs/DocsCrawler.ts @@ -39,13 +39,11 @@ class DocsCrawler { maxRequestsPerCrawl: number = this.MAX_REQUESTS_PER_CRAWL, ): AsyncGenerator { if (startUrl.host === this.GITHUB_HOST) { - console.log("GITHUB DETECTED: Using Github"); yield* new GitHubCrawler(startUrl).crawl(); return; } try { - console.log(`Crawling ${startUrl.toString()}: Trying default crawler`); const pageData = await new DefaultCrawler(startUrl).crawl(); if (pageData.length > 0) { yield* pageData; @@ -56,11 +54,9 @@ class DocsCrawler { } if (this.shouldUseChromium()) { - console.log(`Crawling ${startUrl.toString()}: Trying chromium crawler`); yield* new ChromiumCrawler(startUrl, maxRequestsPerCrawl).crawl(); } else { let didCrawlSinglePage = false; - console.log(`Crawling ${startUrl.toString()}: Trying cheerio crawler`); for await (const pageData of new CheerioCrawler( startUrl, @@ -77,10 +73,6 @@ class DocsCrawler { this.chromiumInstaller.shouldProposeUseChromiumOnCrawlFailure(); if (shouldProposeUseChromium) { - console.log( - `Crawling ${startUrl.toString()}: Cheerio failed: proposing chromium crawler`, - ); - const didInstall = await this.chromiumInstaller.proposeAndAttemptInstall( startUrl.toString(), diff --git a/core/indexing/docs/crawlers/GithubCrawler.test.ts b/core/indexing/docs/crawlers/GithubCrawler.test.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/gui/src/components/mainInput/MentionExtension.ts b/gui/src/components/mainInput/MentionExtension.ts index b17f2ee76..364b241ee 100644 --- a/gui/src/components/mainInput/MentionExtension.ts +++ b/gui/src/components/mainInput/MentionExtension.ts @@ -31,7 +31,6 @@ export const Mention = Node.create({ char: "@", pluginKey: MentionPluginKey, command: ({ editor, range, props }) => { - console.log(props); // increase range.to by one when the next node is of type "text" // and starts with a space character const nodeAfter = editor.view.state.selection.$to.nodeAfter; diff --git a/gui/src/components/mainInput/resolveInput.ts b/gui/src/components/mainInput/resolveInput.ts index ae1a97cea..c9e1b698a 100644 --- a/gui/src/components/mainInput/resolveInput.ts +++ b/gui/src/components/mainInput/resolveInput.ts @@ -52,7 +52,6 @@ async function resolveEditorContent({ for (const p of editorState.content) { if (p.type === "paragraph") { const [text, ctxItems, foundSlashCommand] = resolveParagraph(p); - console.log("PARAGRAPH RESOLVE", ctxItems); // Only take the first slash command\ if (foundSlashCommand && typeof slashCommand === "undefined") { slashCommand = foundSlashCommand; @@ -137,7 +136,6 @@ async function resolveEditorContent({ } } - console.log(stripImages(parts), contextItems); // cmd+enter to use codebase if (modifiers.useCodebase) { const result = await ideMessenger.request("context/getContextItems", { @@ -218,7 +216,6 @@ function resolveParagraph( if (child.type === "text") { text += text === "" ? child.text?.trimStart() : child.text; } else if (child.type === "mention") { - console.log("CHILD", child); text += typeof child.attrs?.renderInlineAs === "string" ? child.attrs.renderInlineAs From 6a93bd991362be2df2155873b453785f08bdef42 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sun, 19 Jan 2025 22:08:13 -0800 Subject: [PATCH 008/111] fix import --- gui/src/components/mainInput/MentionList.tsx | 393 +++++++++--------- gui/src/components/mainInput/getSuggestion.ts | 2 +- 2 files changed, 203 insertions(+), 192 deletions(-) diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index 74c074b1a..530144e4a 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -71,7 +71,6 @@ const ICONS_FOR_DROPDOWN: { [key: string]: any } = { debugger: BugAntIcon, os: CpuChipIcon, tree: Bars3BottomLeftIcon, - trash: TrashIcon, "prompt-files": DocumentTextIcon, "repo-map": FolderIcon, "/clear": TrashIcon, @@ -82,6 +81,7 @@ const ICONS_FOR_DROPDOWN: { [key: string]: any } = { google: GoogleIcon, "gitlab-mr": GitlabIcon, http: GlobeAltIcon, + trash: TrashIcon, }; export function getIconFromDropdownItem( @@ -190,199 +190,209 @@ interface MentionListProps { onClose: () => void; } -export const MentionList = forwardRef( - (props: MentionListProps, ref) => { - const dispatch = useDispatch(); +const MentionList = forwardRef((props: MentionListProps, ref) => { + const dispatch = useDispatch(); - const ideMessenger = useContext(IdeMessengerContext); + const ideMessenger = useContext(IdeMessengerContext); - const [selectedIndex, setSelectedIndex] = useState(0); + const [selectedIndex, setSelectedIndex] = useState(0); - const [subMenuTitle, setSubMenuTitle] = useState( - undefined, - ); - const [querySubmenuItem, setQuerySubmenuItem] = useState< - ComboBoxItem | undefined - >(undefined); + const [subMenuTitle, setSubMenuTitle] = useState( + undefined, + ); + const [querySubmenuItem, setQuerySubmenuItem] = useState< + ComboBoxItem | undefined + >(undefined); - const [allItems, setAllItems] = useState([]); + const [allItems, setAllItems] = useState([]); - useEffect(() => { - const items = [...props.items]; - if (subMenuTitle === "Type to search docs") { - items.push({ - title: "Add Docs", - type: "action", - action: () => { - dispatch(setShowDialog(true)); - dispatch(setDialogMessage()); + useEffect(() => { + const items = [...props.items]; + if (subMenuTitle === "Type to search docs") { + items.push({ + title: "Add Docs", + type: "action", + action: () => { + dispatch(setShowDialog(true)); + dispatch(setDialogMessage()); - // Delete back to last '@' - const { tr } = props.editor.view.state; - const text = tr.doc.textBetween(0, tr.selection.from); - const start = text.lastIndexOf("@"); + // Delete back to last '@' + const { tr } = props.editor.view.state; + const text = tr.doc.textBetween(0, tr.selection.from); + const start = text.lastIndexOf("@"); + props.editor.view.dispatch( + tr.delete(start, tr.selection.from).scrollIntoView(), + ); + }, + description: "Add a new documentation source", + }); + } else if (subMenuTitle === ".prompt files") { + items.push({ + title: "New .prompt file", + type: "action", + action: () => { + ideMessenger.post("config/newPromptFile", undefined); + const { tr } = props.editor.view.state; + const text = tr.doc.textBetween(0, tr.selection.from); + const start = text.lastIndexOf("@"); + if (start !== -1) { props.editor.view.dispatch( tr.delete(start, tr.selection.from).scrollIntoView(), ); - }, - description: "Add a new documentation source", - }); - } else if (subMenuTitle === ".prompt files") { - items.push({ - title: "New .prompt file", - type: "action", - action: () => { - ideMessenger.post("config/newPromptFile", undefined); - const { tr } = props.editor.view.state; - const text = tr.doc.textBetween(0, tr.selection.from); - const start = text.lastIndexOf("@"); - if (start !== -1) { - props.editor.view.dispatch( - tr.delete(start, tr.selection.from).scrollIntoView(), - ); - } - props.onClose(); // Escape the mention list after creating a new prompt file - }, - description: "Create a new .prompt file", - }); - } - - setAllItems(items); - }, [subMenuTitle, props.items, props.editor]); - - const queryInputRef = useRef(null); - - useEffect(() => { - if (queryInputRef.current) { - queryInputRef.current.focus(); - } - }, [querySubmenuItem]); - - const selectItem = (index: number) => { - const item = allItems[index]; - - if (item.type === "action" && item.action) { - item.action(); - return; - } - - if ( - item.type === "contextProvider" && - item.contextProvider?.type === "submenu" - ) { - setSubMenuTitle(item.description); - if (item.id) { - props.enterSubmenu?.(props.editor, item.id); - } - return; - } - - if (item.contextProvider?.type === "query") { - // update editor to complete context provider title - const { tr } = props.editor.view.state; - const text = tr.doc.textBetween(0, tr.selection.from); - const partialText = text.slice(text.lastIndexOf("@") + 1); - const remainingText = item.title.slice(partialText.length); - props.editor.view.dispatch( - tr.insertText(remainingText, tr.selection.from), - ); - - setSubMenuTitle(item.description); - setQuerySubmenuItem(item); - return; - } - - if (item) { - props.command({ ...item, itemType: item.type }); - } - }; - - const totalItems = allItems.length; - - const itemRefs = useRef>([]); - - const upHandler = () => { - setSelectedIndex((prevIndex) => { - const newIndex = prevIndex - 1 >= 0 ? prevIndex - 1 : 0; - itemRefs.current[newIndex]?.scrollIntoView({ - behavior: "instant" as ScrollBehavior, - block: "nearest", - }); - return newIndex; - }); - }; - - const downHandler = () => { - setSelectedIndex((prevIndex) => { - const newIndex = prevIndex + 1 < totalItems ? prevIndex + 1 : prevIndex; - itemRefs.current[newIndex]?.scrollIntoView({ - behavior: "instant" as ScrollBehavior, - block: "nearest", - }); - return newIndex; - }); - }; - - const enterHandler = () => { - selectItem(selectedIndex); - }; - - useEffect(() => setSelectedIndex(0), [allItems]); - - useImperativeHandle(ref, () => ({ - onKeyDown: ({ event }: { event: KeyboardEvent }) => { - if (event.key === "ArrowUp") { - upHandler(); - return true; - } - - if (event.key === "ArrowDown") { - downHandler(); - return true; - } - - if (event.key === "Enter" || event.key === "Tab") { - enterHandler(); - event.stopPropagation(); - event.preventDefault(); - return true; - } - - if (event.key === "Escape") { - event.preventDefault(); - event.stopPropagation(); - return true; - } - - if (event.key === " ") { - if (allItems.length === 1) { - enterHandler(); - return true; } + props.onClose(); // Escape the mention list after creating a new prompt file + }, + description: "Create a new .prompt file", + }); + } + + setAllItems(items); + }, [subMenuTitle, props.items, props.editor]); + + const queryInputRef = useRef(null); + + useEffect(() => { + if (queryInputRef.current) { + queryInputRef.current.focus(); + } + }, [querySubmenuItem]); + + const selectItem = (index: number) => { + const item = allItems[index]; + + if (item.type === "action" && item.action) { + item.action(); + return; + } + + if ( + item.type === "contextProvider" && + item.contextProvider?.type === "submenu" + ) { + setSubMenuTitle(item.description); + if (item.id) { + props.enterSubmenu?.(props.editor, item.id); + } + return; + } + + if (item.contextProvider?.type === "query") { + // update editor to complete context provider title + const { tr } = props.editor.view.state; + const text = tr.doc.textBetween(0, tr.selection.from); + const partialText = text.slice(text.lastIndexOf("@") + 1); + const remainingText = item.title.slice(partialText.length); + props.editor.view.dispatch( + tr.insertText(remainingText, tr.selection.from), + ); + + setSubMenuTitle(item.description); + setQuerySubmenuItem(item); + return; + } + + if (item) { + props.command({ ...item, itemType: item.type }); + } + }; + + const totalItems = allItems.length; + + const itemRefs = useRef>([]); + + const upHandler = () => { + setSelectedIndex((prevIndex) => { + const newIndex = prevIndex - 1 >= 0 ? prevIndex - 1 : 0; + itemRefs.current[newIndex]?.scrollIntoView({ + behavior: "instant" as ScrollBehavior, + block: "nearest", + }); + return newIndex; + }); + }; + + const downHandler = () => { + setSelectedIndex((prevIndex) => { + const newIndex = prevIndex + 1 < totalItems ? prevIndex + 1 : prevIndex; + itemRefs.current[newIndex]?.scrollIntoView({ + behavior: "instant" as ScrollBehavior, + block: "nearest", + }); + return newIndex; + }); + }; + + const enterHandler = () => { + selectItem(selectedIndex); + }; + + useEffect(() => setSelectedIndex(0), [allItems]); + + useImperativeHandle(ref, () => ({ + onKeyDown: ({ event }: { event: KeyboardEvent }) => { + if (event.key === "ArrowUp") { + upHandler(); + return true; + } + + if (event.key === "ArrowDown") { + downHandler(); + return true; + } + + if (event.key === "Enter" || event.key === "Tab") { + enterHandler(); + event.stopPropagation(); + event.preventDefault(); + return true; + } + + if (event.key === "Escape") { + event.preventDefault(); + event.stopPropagation(); + return true; + } + + if (event.key === " ") { + if (allItems.length === 1) { + enterHandler(); + return true; } + } - return false; - }, - })); + return false; + }, + })); - const showFileIconForItem = (item: ComboBoxItem) => { - return ["file", "code"].includes(item.type); - }; + const showFileIconForItem = (item: ComboBoxItem) => { + return ["file", "code"].includes(item.type); + }; - useEffect(() => { - itemRefs.current = itemRefs.current.slice(0, allItems.length); - }, [allItems]); + useEffect(() => { + itemRefs.current = itemRefs.current.slice(0, allItems.length); + }, [allItems]); - return ( - - {querySubmenuItem ? ( - { - if (!queryInputRef.current) { - return; + return ( + + {querySubmenuItem ? ( + { + if (!queryInputRef.current) { + return; + } + if (e.key === "Enter") { + if (e.shiftKey) { + queryInputRef.current.innerText += "\n"; + } else { + props.command({ + ...querySubmenuItem, + itemType: querySubmenuItem.type, + query: queryInputRef.current.value, + label: `${querySubmenuItem.label}: ${queryInputRef.current.value}`, + }); } } else if (e.key === "Escape") { setQuerySubmenuItem(undefined); @@ -462,15 +472,16 @@ export const MentionList = forwardRef( ); })} - - )) - ) : ( - No results - )} - {/* */} - - )} - - ); - }, -); + + + )) + ) : ( + No results + )} + {/* */} + + )} + + ); +}); +export default MentionList; diff --git a/gui/src/components/mainInput/getSuggestion.ts b/gui/src/components/mainInput/getSuggestion.ts index 4d3590c19..ecc7b835e 100644 --- a/gui/src/components/mainInput/getSuggestion.ts +++ b/gui/src/components/mainInput/getSuggestion.ts @@ -7,7 +7,7 @@ import { import { MutableRefObject } from "react"; import tippy from "tippy.js"; import { IIdeMessenger } from "../../context/IdeMessenger"; -import { MentionList } from "./MentionList"; +import MentionList from "./MentionList"; import { ComboBoxItem, ComboBoxItemType, ComboBoxSubAction } from "./types"; import { TIPPY_DIV_ID } from "./TipTapEditor"; From c637b7ba3d9fc175052f5499623dfc7ec3d328d7 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sun, 19 Jan 2025 22:17:59 -0800 Subject: [PATCH 009/111] don't persist indexing status --- gui/src/redux/store.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 4432b3be6..b1c74f34b 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -36,6 +36,7 @@ const saveSubsetFilters = [ createFilter("editModeState", []), createFilter("config", ["defaultModelTitle"]), createFilter("ui", ["toolSettings", "useTools"]), + createFilter("indexing", []), ]; const migrations: MigrationManifest = { From 3286a93d738613688e9d5996652457f20c6dc5a2 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sun, 19 Jan 2025 23:08:33 -0800 Subject: [PATCH 010/111] remove unused useFilePrefix --- core/config/types.ts | 1 - core/util/parameters.ts | 1 - docs/docs/customize/deep-dives/autocomplete.md | 1 - docs/docs/reference.md | 1 - .../current/customize/deep-dives/autocomplete.md | 1 - .../zh-CN/docusaurus-plugin-content-docs/current/reference.md | 1 - extensions/vscode/config_schema.json | 4 ---- packages/config-types/src/index.ts | 1 - 8 files changed, 11 deletions(-) diff --git a/core/config/types.ts b/core/config/types.ts index e5797bdb7..6d2847c11 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -902,7 +902,6 @@ declare global { export interface TabAutocompleteOptions { disable: boolean; - useFileSuffix: boolean; maxPromptTokens: number; debounceDelay: number; maxSuffixPercentage: number; diff --git a/core/util/parameters.ts b/core/util/parameters.ts index a7a11b503..648253712 100644 --- a/core/util/parameters.ts +++ b/core/util/parameters.ts @@ -2,7 +2,6 @@ import { TabAutocompleteOptions } from "../index.js"; export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = { disable: false, - useFileSuffix: true, maxPromptTokens: 1024, prefixPercentage: 0.3, maxSuffixPercentage: 0.2, diff --git a/docs/docs/customize/deep-dives/autocomplete.md b/docs/docs/customize/deep-dives/autocomplete.md index 221a6d49f..a5e143e23 100644 --- a/docs/docs/customize/deep-dives/autocomplete.md +++ b/docs/docs/customize/deep-dives/autocomplete.md @@ -60,7 +60,6 @@ This object allows you to customize the behavior of tab-autocomplete. The availa - `disable`: Disable autocomplete (can also be done from IDE settings) - `template`: An optional template string to be used for autocomplete. It will be rendered with the Mustache templating language, and is passed the 'prefix' and 'suffix' variables. (String) -- `useFileSuffix`: Determines whether to use the file suffix in the prompt. (Boolean) - `maxPromptTokens`: The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number) - `prefixPercentage`: The percentage of the input that should be dedicated to the prefix. (Number) - `maxSuffixPercentage`: The maximum percentage of the prompt that can be dedicated to the suffix. (Number) diff --git a/docs/docs/reference.md b/docs/docs/reference.md index d3c491f4c..3e2ab48da 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -83,7 +83,6 @@ Specifies options for tab autocompletion behavior. **Properties:** - `disable`: If `true`, disables tab autocomplete (default: `false`). -- `useFileSuffix`: If `true`, includes file suffix in the prompt. - `maxPromptTokens`: Maximum number of tokens for the prompt. - `debounceDelay`: Delay (in ms) before triggering autocomplete. - `maxSuffixPercentage`: Maximum percentage of prompt for suffix. diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/autocomplete.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/autocomplete.md index 15cb94c4d..985a66809 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/autocomplete.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/deep-dives/autocomplete.md @@ -60,7 +60,6 @@ ollama run starcoder2:3b - `disable`: 禁用自动补全(也可以在 IDE 配置中完成) - `template`: 一个用来自动补全的可选的模板字符串。它使用 Mustache 模板语言渲染,并且传递 'prefix' 和 'suffix' 变量。(字符串) -- `useFileSuffix`: 决定是否使用文件后缀在提示词中。(布尔型) - `maxPromptTokens`: 提示词使用的 token 的最大数量。一个较小的数字生成较快的补全,但是较少的上下文。(数字) - `prefixPercentage`: 输入专注于前缀的百分比。(数字) - `maxSuffixPercentage`: The maximum percentage of the prompt that can be dedicated to the suffix. (Number) diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md index 0eeacafec..f7ba51cbf 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference.md @@ -83,7 +83,6 @@ Specifies options for tab autocompletion behavior. **Properties:** - `disable`: If `true`, disables tab autocomplete (default: `false`). -- `useFileSuffix`: If `true`, includes file suffix in the prompt. - `maxPromptTokens`: Maximum number of tokens for the prompt. - `debounceDelay`: Delay (in ms) before triggering autocomplete. - `maxSuffixPercentage`: Maximum percentage of prompt for suffix. diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 1273a7c40..2b12cf21e 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -3080,10 +3080,6 @@ "description": "Disable tab autocomplete. This can also be done from the IDE settings.", "default": false }, - "useFileSuffix": { - "type": "boolean", - "description": "Determines whether to use the file suffix in the prompt." - }, "maxPromptTokens": { "type": "number", "description": "The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context." diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index 5ba03b8cc..8a0806d7b 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -133,7 +133,6 @@ export type UiOptions = z.infer; export const tabAutocompleteOptionsSchema = z.object({ disable: z.boolean(), - useFileSuffix: z.boolean(), maxPromptTokens: z.number(), debounceDelay: z.number(), maxSuffixPercentage: z.number(), From f162286f2359c20b2af987693a3623846e153172 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 20 Jan 2025 01:09:23 -0800 Subject: [PATCH 011/111] use file suffix removal p2 --- core/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/core/index.d.ts b/core/index.d.ts index 098628c0f..7f98129f2 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -940,7 +940,6 @@ export interface RerankerDescription { export interface TabAutocompleteOptions { disable: boolean; - useFileSuffix: boolean; maxPromptTokens: number; debounceDelay: number; maxSuffixPercentage: number; From 1dbee13719321a14e6005151b4c1dc5c0682806d Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 20 Jan 2025 14:16:58 -0800 Subject: [PATCH 012/111] Update bedrock.md --- docs/docs/customize/model-providers/top-level/bedrock.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/customize/model-providers/top-level/bedrock.md b/docs/docs/customize/model-providers/top-level/bedrock.md index 67d919a2f..c2fab040a 100644 --- a/docs/docs/customize/model-providers/top-level/bedrock.md +++ b/docs/docs/customize/model-providers/top-level/bedrock.md @@ -41,9 +41,9 @@ We recommend configuring **Claude 3.5 Sonnet** as your chat model. ## Autocomplete model -Bedrock currently does not offer any autocomplete models. +Bedrock currently does not offer any autocomplete models. However, [Codestral from Mistral](https://mistral.ai/news/codestral-2501/) and [Point from Poolisde](https://aws.amazon.com/bedrock/poolside/) will be supported in the near future. -[Click here](../../model-types/autocomplete.md) to see a list of autocomplete model providers. +In the meantime, you can view a list of autocomplete model providers [here](../../model-types/autocomplete.md). ## Embeddings model From 442b8637fb006fa3f6eed261dbb15b66dc4eebc5 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 20 Jan 2025 15:16:50 -0800 Subject: [PATCH 013/111] free trial logic fixes --- core/config/onboarding.ts | 2 +- extensions/vscode/package-lock.json | 4 ++-- gui/src/components/Layout.tsx | 6 +----- gui/src/pages/gui/Chat.tsx | 27 ++++++++++++--------------- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/core/config/onboarding.ts b/core/config/onboarding.ts index 426a7a4ba..f0a506fdf 100644 --- a/core/config/onboarding.ts +++ b/core/config/onboarding.ts @@ -9,7 +9,7 @@ export const LOCAL_ONBOARDING_CHAT_MODEL = "llama3.1:8b"; export const LOCAL_ONBOARDING_CHAT_TITLE = "Llama 3.1 8B"; /** - * We set the "best" chat + autocopmlete models by default + * We set the "best" chat + autocomplete models by default * whenever a user doesn't have a config.json */ export function setupBestConfig( diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 31f06cbb1..cf132e7ba 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.252", + "version": "0.9.253", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.252", + "version": "0.9.253", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index e8a0deb12..b4fb5fd8a 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -151,11 +151,7 @@ const Layout = () => { "incrementFtc", async () => { const u = getLocalStorage("ftc"); - if (u) { - setLocalStorage("ftc", u + 1); - } else { - setLocalStorage("ftc", 1); - } + setLocalStorage("ftc", (u ?? 0) + 1); }, [], ); diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 3f36adcef..49a4b5f31 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -247,21 +247,18 @@ export function Chat() { editorToClearOnSend?: Editor, ) => { if (defaultModel?.provider === "free-trial") { - const u = getLocalStorage("ftc"); - if (u) { - setLocalStorage("ftc", u + 1); - - if (u >= FREE_TRIAL_LIMIT_REQUESTS) { - onboardingCard.open("Best"); - posthog?.capture("ftc_reached"); - ideMessenger.ide.showToast( - "info", - "You've reached the free trial limit. Please configure a model to continue.", - ); - return; - } - } else { - setLocalStorage("ftc", 1); + const u = getLocalStorage("ftc") ?? 0; + setLocalStorage("ftc", u + 1); + if (u === FREE_TRIAL_LIMIT_REQUESTS) { + posthog?.capture("ftc_reached"); + } + if (u >= FREE_TRIAL_LIMIT_REQUESTS) { + onboardingCard.open("Best"); + ideMessenger.ide.showToast( + "info", + "You've reached the free trial limit. Please configure a model to continue.", + ); + return; } } From 95c87f4763efd4ea576532ff60b836e64b22cd0e Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 20 Jan 2025 15:17:58 -0800 Subject: [PATCH 014/111] fix tutorial card logic --- gui/src/pages/gui/Chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 3f36adcef..2d688a8b3 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -550,7 +550,7 @@ export function Chat() { )} - {showTutorialCard !== false && !onboardingCard.open && ( + {showTutorialCard !== false && !onboardingCard.show && (
From cef9116bd04352906bdd858866ce019aacf372f3 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 20 Jan 2025 19:19:09 -0800 Subject: [PATCH 015/111] tutorial card test --- .../vscode/e2e/selectors/GUI.selectors.ts | 25 +++++++++++ extensions/vscode/e2e/tests/GUI.test.ts | 42 ++++++++++++++++++- .../components/BestExperienceConfigForm.tsx | 2 + .../components/OnboardingCardTabs.tsx | 1 + gui/src/components/mainInput/TutorialCard.tsx | 7 +--- 5 files changed, 71 insertions(+), 6 deletions(-) diff --git a/extensions/vscode/e2e/selectors/GUI.selectors.ts b/extensions/vscode/e2e/selectors/GUI.selectors.ts index 71a38c9f2..319157500 100644 --- a/extensions/vscode/e2e/selectors/GUI.selectors.ts +++ b/extensions/vscode/e2e/selectors/GUI.selectors.ts @@ -79,6 +79,31 @@ export class GUISelectors { ); } + public static getOnboardingTabButton(view: WebView, title: string) { + return SelectorUtils.getElementByDataTestId( + view, + `onboarding-tab-${title}`, + ); + } + + public static getBestChatApiKeyInput(view: WebView) { + return SelectorUtils.getElementByDataTestId( + view, + "best-chat-api-key-input", + ); + } + + public static getBestAutocompleteApiKeyInput(view: WebView) { + return SelectorUtils.getElementByDataTestId( + view, + "best-autocomplete-api-key-input", + ); + } + + public static getTutorialCard(view: WebView) { + return SelectorUtils.getElementByDataTestId(view, "tutorial-card"); + } + public static getThreadMessageByText(view: WebView, text: string) { return view.findWebElement( By.xpath(`//*[@class="thread-message"]//*[contains(text(), "${text}")]`), diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index 316db2d0e..c6ee4d30c 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -1,5 +1,6 @@ import { expect } from "chai"; import { + By, EditorView, Key, VSBrowser, @@ -45,7 +46,7 @@ describe("GUI Test", () => { await new EditorView().closeAllEditors(); }); - describe("Onboarding", () => { + describe.only("Onboarding", () => { it("should display correct panel description", async () => { const description = await GUISelectors.getDescription(view); @@ -53,6 +54,45 @@ describe("GUI Test", () => { "Quickly get up and running using our API keys.", ); }).timeout(DEFAULT_TIMEOUT.XL); + + it("should display tutorial card after accepting onboarding quick start", async () => { + // Get paragraph with text Best + const bestTab = await GUISelectors.getOnboardingTabButton(view, "Best"); + await bestTab.click(); + + const anthropicInput = await TestUtils.waitForSuccess( + async () => await GUISelectors.getBestChatApiKeyInput(view), + ); + anthropicInput.sendKeys("invalid_api_key"); + + const mistralInput = + await GUISelectors.getBestAutocompleteApiKeyInput(view); + mistralInput.sendKeys("invalid_api_key"); + + // Get button with text "Connect" and click it + const connectButton = await view.findWebElement( + By.xpath("//button[text()='Connect']"), + ); + await connectButton.click(); + + await TestUtils.waitForSuccess( + async () => await GUISelectors.getTutorialCard(view), + ); + + // TODO validate that claude has been added to list + + // Skip testing Quick Start because github auth opens external app and breaks test + // const quickStartButton = await view.findWebElement( + // By.xpath("//*[contains(text(), 'Get started using our API keys')]") + // ); + // await quickStartButton.click(); + // await view.switchBack(); + // const allowButton = await TestUtils.waitForSuccess( + // async () => await driver.findElement(By.xpath(`//a[contains(text(), "Allow")]`)) + // ); + // await allowButton.click(); + // ({ view, driver } = await GUIActions.switchToReactIframe()); + }).timeout(DEFAULT_TIMEOUT.XL); }); describe("Chat", () => { diff --git a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx index 575e1e8a3..86e7cd693 100644 --- a/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx +++ b/gui/src/components/OnboardingCard/components/BestExperienceConfigForm.tsx @@ -99,6 +99,7 @@ function BestExperienceConfigForm({ placeholder="Enter your Anthropic API Key" value={chatApiKey} onChange={(e) => setChatApiKey(e.target.value)} + data-testid="best-chat-api-key-input" /> setAutocompleteApiKey(e.target.value)} + data-testid="best-autocomplete-api-key-input" /> onTabClick(tabType as TabTitle)} + data-testid={`onboarding-tab-${tabType}`} >

{titles.default} diff --git a/gui/src/components/mainInput/TutorialCard.tsx b/gui/src/components/mainInput/TutorialCard.tsx index 4e07ead6d..c94f63598 100644 --- a/gui/src/components/mainInput/TutorialCard.tsx +++ b/gui/src/components/mainInput/TutorialCard.tsx @@ -44,7 +44,7 @@ export function TutorialCard({ onClose }: TutorialCardProps) { const ideMessenger = useContext(IdeMessengerContext); return ( - + @@ -57,10 +57,7 @@ export function TutorialCard({ onClose }: TutorialCardProps) { - ideMessenger.post( - "vscode/openMoveRightMarkdown", - undefined, - ) + ideMessenger.post("vscode/openMoveRightMarkdown", undefined) } > Move Chat panel to the right From 9109fb2cfc34fdc1613c9372c32b9f3d8ff7dcb8 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 20 Jan 2025 19:42:52 -0800 Subject: [PATCH 016/111] remove describe.only --- extensions/vscode/e2e/tests/GUI.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index c6ee4d30c..4369a917f 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -46,7 +46,7 @@ describe("GUI Test", () => { await new EditorView().closeAllEditors(); }); - describe.only("Onboarding", () => { + describe("Onboarding", () => { it("should display correct panel description", async () => { const description = await GUISelectors.getDescription(view); From 79213304c1b5b3a4f9b33c5fbd595b089009ad96 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 20 Jan 2025 21:26:12 -0800 Subject: [PATCH 017/111] free trial over --- .../dialogs/FreeTrialOverDialog.tsx | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 gui/src/components/dialogs/FreeTrialOverDialog.tsx diff --git a/gui/src/components/dialogs/FreeTrialOverDialog.tsx b/gui/src/components/dialogs/FreeTrialOverDialog.tsx new file mode 100644 index 000000000..4bf68a770 --- /dev/null +++ b/gui/src/components/dialogs/FreeTrialOverDialog.tsx @@ -0,0 +1,54 @@ +import { useDispatch } from "react-redux"; +import styled from "styled-components"; +import { Button, SecondaryButton } from ".."; +import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; + +interface FreeTrialOverDialogProps { + onConfirm: () => void; + onCancel?: () => void; + text: string; + title?: string; + hideCancelButton?: boolean; + confirmText?: string; +} + +function FreeTrialOverDialog(props: FreeTrialOverDialogProps) { + const dispatch = useDispatch(); + + return ( +

+

+ {props.title ?? "Confirmation"} +

+

+ {props.text} +

+ +
+ {!!props.hideCancelButton || ( + { + dispatch(setShowDialog(false)); + dispatch(setDialogMessage(undefined)); + props.onCancel?.(); + }} + > + Cancel + + )} + +
+
+ ); +} + +export default FreeTrialOverDialog; From d166bcd8354a835fded45aa3eff82f34f7e769b9 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 21 Jan 2025 09:54:21 -0800 Subject: [PATCH 018/111] Update Edit.test.ts --- extensions/vscode/e2e/tests/Edit.test.ts | 80 ++++++++++++++---------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/extensions/vscode/e2e/tests/Edit.test.ts b/extensions/vscode/e2e/tests/Edit.test.ts index e79dd010c..66b82aaf3 100644 --- a/extensions/vscode/e2e/tests/Edit.test.ts +++ b/extensions/vscode/e2e/tests/Edit.test.ts @@ -1,19 +1,15 @@ +import { expect } from "chai"; import { - EditorView, WebView, - WebDriver, - Key, VSBrowser, - InputBox, TextEditor, - Workbench, + CodeLens, } from "vscode-extension-tester"; import { EditActions } from "../actions/Edit.actions"; import { GlobalActions } from "../actions/Global.actions"; import { GUIActions } from "../actions/GUI.actions"; import { DEFAULT_TIMEOUT } from "../constants"; -import { EditSelectors } from "../selectors/Edit.selectors"; import { GUISelectors } from "../selectors/GUI.selectors"; import { TestUtils } from "../TestUtils"; @@ -58,9 +54,27 @@ describe("Edit Test", () => { afterEach(async function () { this.timeout(DEFAULT_TIMEOUT.XL); + await editor.clearText(); + + ({ view } = await GUIActions.switchToReactIframe()); + + const tipTapEditor = await GUISelectors.getMessageInputFieldAtIndex( + view, + 0, + ); + await tipTapEditor.clear(); }); + async function getCodeLensWithRetry(editor: TextEditor, text: string) { + let codeLens: CodeLens | undefined; + await TestUtils.waitForSuccess(async () => { + codeLens = await editor.getCodeLens(text); + expect(codeLens).to.not.be.undefined; + }, DEFAULT_TIMEOUT.SM); + return codeLens; + } + it("Accepts an Edit in the GUI", async () => { ({ view } = await GUIActions.switchToReactIframe()); @@ -68,14 +82,14 @@ describe("Edit Test", () => { await view.switchBack(); - const editorText = await editor.getText(); + await TestUtils.waitForSuccess(async () => { + const editorText = await editor.getText(); - await TestUtils.waitForSuccess( - async () => + expect( !editorText.includes(originalEditorText) && - editorText.includes(llmResponse), - DEFAULT_TIMEOUT.SM, - ); + editorText.includes(llmResponse), + ).to.be.true; + }, DEFAULT_TIMEOUT.SM); }).timeout(DEFAULT_TIMEOUT.XL); it("Rejects an Edit in the GUI", async () => { @@ -85,41 +99,41 @@ describe("Edit Test", () => { await view.switchBack(); - const editorText = await editor.getText(); + await TestUtils.waitForSuccess(async () => { + const editorText = await editor.getText(); - await TestUtils.waitForSuccess( - async () => + expect( editorText.includes(originalEditorText) && - !editorText.includes(llmResponse), - DEFAULT_TIMEOUT.SM, - ); + !editorText.includes(llmResponse), + ).to.be.true; + }, DEFAULT_TIMEOUT.SM); }).timeout(DEFAULT_TIMEOUT.XL); it("Accepts an Edit using CodeLens buttons", async () => { const acceptCodeLens = await editor.getCodeLens("Accept"); await acceptCodeLens?.click(); - const editorText = await editor.getText(); + await TestUtils.waitForSuccess(async () => { + const editorText = await editor.getText(); - await TestUtils.waitForSuccess( - async () => + expect( !editorText.includes(originalEditorText) && - editorText.includes(llmResponse), - DEFAULT_TIMEOUT.SM, - ); + editorText.includes(llmResponse), + ).to.be.true; + }, DEFAULT_TIMEOUT.SM); }).timeout(DEFAULT_TIMEOUT.XL); - it("Rejects an Edit using CodeLens buttons", async () => { - const rejectCodeLens = await editor.getCodeLens("Reject"); + it.only("Rejects an Edit using CodeLens buttons", async () => { + const rejectCodeLens = await getCodeLensWithRetry(editor, "Reject"); await rejectCodeLens?.click(); - const editorText = await editor.getText(); + await TestUtils.waitForSuccess(async () => { + const editorText = await editor.getText(); - await TestUtils.waitForSuccess( - async () => - !editorText.includes(originalEditorText) && - editorText.includes(llmResponse), - DEFAULT_TIMEOUT.SM, - ); + expect( + editorText.includes(originalEditorText) && + !editorText.includes(llmResponse), + ).to.be.true; + }, DEFAULT_TIMEOUT.SM); }).timeout(DEFAULT_TIMEOUT.XL); }); From 498a43fb7971b2a61baa0b81222bcaccf25bf1f7 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 10:21:52 -0800 Subject: [PATCH 019/111] dialog onboarding --- extensions/vscode/package-lock.json | 4 ++-- .../OnboardingCard/components/OllamaStatus.tsx | 13 +++++++++---- .../platform/PlatformOnboardingCard.tsx | 12 ++++++++++++ gui/src/components/dialogs/FreeTrialOverDialog.tsx | 10 ++++++++++ gui/src/components/dialogs/index.tsx | 2 +- gui/src/pages/gui/Chat.tsx | 7 +++++++ 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index cf132e7ba..31f06cbb1 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.253", + "version": "0.9.252", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.253", + "version": "0.9.252", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx index 15132518e..24a9f511d 100644 --- a/gui/src/components/OnboardingCard/components/OllamaStatus.tsx +++ b/gui/src/components/OnboardingCard/components/OllamaStatus.tsx @@ -2,7 +2,7 @@ import { ArrowPathIcon, ArrowTopRightOnSquareIcon, } from "@heroicons/react/24/outline"; -import { useState, useContext } from "react"; +import { useState, useContext, useEffect } from "react"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { providers } from "../../../pages/AddNewModel/configs/providers"; import { StyledActionButton } from "../.."; @@ -19,10 +19,15 @@ export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) { const ideMessenger = useContext(IdeMessengerContext); const [status, setStatus] = useState( - isOllamaConnected - ? OllamaConnectionStatuses.Connected - : OllamaConnectionStatuses.WaitingToDownload, + OllamaConnectionStatuses.WaitingToDownload, ); + useEffect(() => { + if (isOllamaConnected) { + setStatus(OllamaConnectionStatuses.Connected); + } else if (status !== OllamaConnectionStatuses.Downloading) { + setStatus(OllamaConnectionStatuses.WaitingToDownload); + } + }, [status, isOllamaConnected]); function onClickDownload() { ideMessenger.post("openUrl", downloadUrl); diff --git a/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx index 360282e4a..6b7eced1b 100644 --- a/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx +++ b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx @@ -8,6 +8,8 @@ import { TabTitle } from "../components/OnboardingCardTabs"; import { useOnboardingCard } from "../hooks"; import OnboardingLocalTab from "../tabs/OnboardingLocalTab"; import MainTab from "./tabs/main"; +import { hasPassedFTL } from "../../../util/freeTrial"; +import { useAppSelector } from "../../../redux/hooks"; const StyledCard = styled.div` margin: auto; @@ -30,8 +32,18 @@ export function PlatformOnboardingCard() { setLocalStorage("onboardingStatus", "Started"); } + const isPastFreeTrialLimit = hasPassedFTL(); + const isShowingDialog = useAppSelector((store) => store.ui.showDialog); + const [currentTab, setCurrentTab] = useState<"main" | "local">("main"); + // A version of this pops up in a dialog + // so that history doesn't disappear or jump + // If free trial limit is reached mid-chat + if (isPastFreeTrialLimit && isShowingDialog) { + return null; + } + return ( diff --git a/gui/src/components/dialogs/FreeTrialOverDialog.tsx b/gui/src/components/dialogs/FreeTrialOverDialog.tsx index 4bf68a770..c5e0e9745 100644 --- a/gui/src/components/dialogs/FreeTrialOverDialog.tsx +++ b/gui/src/components/dialogs/FreeTrialOverDialog.tsx @@ -2,6 +2,8 @@ import { useDispatch } from "react-redux"; import styled from "styled-components"; import { Button, SecondaryButton } from ".."; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; +import { useAppSelector } from "../../redux/hooks"; +import { useEffect } from "react"; interface FreeTrialOverDialogProps { onConfirm: () => void; @@ -14,6 +16,14 @@ interface FreeTrialOverDialogProps { function FreeTrialOverDialog(props: FreeTrialOverDialogProps) { const dispatch = useDispatch(); + const history = useAppSelector((store) => store.session.history); + + useEffect(() => { + if (history.length === 0) { + dispatch(setShowDialog(false)); + dispatch(setDialogMessage(undefined)); + } + }, [history]); return (
diff --git a/gui/src/components/dialogs/index.tsx b/gui/src/components/dialogs/index.tsx index 9e515d6cb..1cf0567ee 100644 --- a/gui/src/components/dialogs/index.tsx +++ b/gui/src/components/dialogs/index.tsx @@ -78,7 +78,7 @@ const TextDialog = (props: TextDialogProps) => { > - + {typeof props.message === "string" ? ( diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 49a4b5f31..81dbf268c 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -247,12 +247,18 @@ export function Chat() { editorToClearOnSend?: Editor, ) => { if (defaultModel?.provider === "free-trial") { + dispatch(setDialogMessage()); + dispatch(setShowDialog(true)); + return; const u = getLocalStorage("ftc") ?? 0; setLocalStorage("ftc", u + 1); if (u === FREE_TRIAL_LIMIT_REQUESTS) { posthog?.capture("ftc_reached"); } if (u >= FREE_TRIAL_LIMIT_REQUESTS) { + if (usePlatform) { + } else { + } onboardingCard.open("Best"); ideMessenger.ide.showToast( "info", @@ -298,6 +304,7 @@ export function Chat() { streamResponse, isSingleRangeEditOrInsertion, codeToEdit, + usePlatform, ], ); From 08cfd6a65e2b9e1d844e9f621a309c9da9d40fae Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 10:46:02 -0800 Subject: [PATCH 020/111] update image plugin styling --- gui/src/components/mainInput/TipTapEditor.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 8b360457d..cde2975b7 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -303,7 +303,6 @@ function TipTapEditor(props: TipTapEditorProps) { "Images need to be in jpg or png format and less than 10MB in size.", ]); } - return undefined; } const { prevRef, nextRef, addRef } = useInputHistory(props.historyKey); @@ -351,7 +350,7 @@ function TipTapEditor(props: TipTapEditorProps) { }, }).configure({ HTMLAttributes: { - class: "editor-image bg-black object-contain max-h-[250px] w-full", + class: "object-contain max-h-[210px] max-w-full", }, }), Placeholder.configure({ @@ -802,7 +801,7 @@ function TipTapEditor(props: TipTapEditorProps) { const contextItem = rifWithContentsToContextItem( data.rangeInFileWithContents, ); - console.log(contextItem); + let index = 0; for (const el of editor.getJSON()?.content ?? []) { if (el.attrs?.item?.name === contextItem.name) { From e971c393b6931db731e3e38ad7d29ccc2fe86781 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 11:32:20 -0800 Subject: [PATCH 021/111] free trial over dialog --- gui/src/components/Footer.tsx | 3 +- gui/src/components/Layout.tsx | 5 +- .../OnboardingCard/OnboardingCard.tsx | 14 +++-- .../platform/PlatformOnboardingCard.tsx | 14 +++-- .../dialogs/FreeTrialOverDialog.tsx | 56 ++++--------------- gui/src/pages/gui/Chat.tsx | 33 ++++++----- gui/src/util/freeTrial.ts | 12 ++-- 7 files changed, 57 insertions(+), 80 deletions(-) diff --git a/gui/src/components/Footer.tsx b/gui/src/components/Footer.tsx index 9b5a6840c..b2efd221c 100644 --- a/gui/src/components/Footer.tsx +++ b/gui/src/components/Footer.tsx @@ -1,6 +1,7 @@ import { useAppSelector } from "../redux/hooks"; import { selectDefaultModel } from "../redux/slices/configSlice"; import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial"; +import { getLocalStorage } from "../util/localStorage"; import FreeTrialProgressBar from "./loaders/FreeTrialProgressBar"; function Footer() { @@ -10,7 +11,7 @@ function Footer() { return (
diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index b4fb5fd8a..cadaa5830 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -13,7 +13,6 @@ import { newSession, } from "../redux/slices/sessionSlice"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; -import { getLocalStorage, setLocalStorage } from "../util/localStorage"; import { ROUTES } from "../util/navigation"; import TextDialog from "./dialogs"; import Footer from "./Footer"; @@ -23,6 +22,7 @@ import AccountDialog from "./AccountDialog"; import { AuthProvider } from "../context/Auth"; import { exitEditMode } from "../redux/thunks"; import { loadLastSession, saveCurrentSession } from "../redux/thunks/session"; +import { incrementFreeTrialCount } from "../util/freeTrial"; const LayoutTopDiv = styled(CustomScrollbarDiv)` height: 100%; @@ -150,8 +150,7 @@ const Layout = () => { useWebviewListener( "incrementFtc", async () => { - const u = getLocalStorage("ftc"); - setLocalStorage("ftc", (u ?? 0) + 1); + incrementFreeTrialCount(); }, [], ); diff --git a/gui/src/components/OnboardingCard/OnboardingCard.tsx b/gui/src/components/OnboardingCard/OnboardingCard.tsx index 78caa4b5b..ed6bbe75b 100644 --- a/gui/src/components/OnboardingCard/OnboardingCard.tsx +++ b/gui/src/components/OnboardingCard/OnboardingCard.tsx @@ -20,7 +20,11 @@ export interface OnboardingCardState { activeTab?: TabTitle; } -export function OnboardingCard() { +interface OnboardingCardProps { + isDialog?: boolean; +} + +export function OnboardingCard({ isDialog }: OnboardingCardProps) { const onboardingCard = useOnboardingCard(); function renderTabContent() { @@ -49,9 +53,11 @@ export function OnboardingCard() { activeTab={onboardingCard.activeTab || "Best"} onTabClick={onboardingCard.setActiveTab} /> - - - + {!isDialog && ( + + + + )}
{renderTabContent()}
); diff --git a/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx index 6b7eced1b..f6b142ab8 100644 --- a/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx +++ b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx @@ -25,7 +25,11 @@ export interface OnboardingCardState { activeTab?: TabTitle; } -export function PlatformOnboardingCard() { +interface OnboardingCardProps { + isDialog?: boolean; +} + +export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) { const onboardingCard = useOnboardingCard(); if (getLocalStorage("onboardingStatus") === undefined) { @@ -46,9 +50,11 @@ export function PlatformOnboardingCard() { return ( - - - + {!isDialog && ( + + + + )}
{currentTab === "main" ? ( diff --git a/gui/src/components/dialogs/FreeTrialOverDialog.tsx b/gui/src/components/dialogs/FreeTrialOverDialog.tsx index c5e0e9745..c3718ccc9 100644 --- a/gui/src/components/dialogs/FreeTrialOverDialog.tsx +++ b/gui/src/components/dialogs/FreeTrialOverDialog.tsx @@ -1,22 +1,15 @@ import { useDispatch } from "react-redux"; -import styled from "styled-components"; -import { Button, SecondaryButton } from ".."; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; import { useAppSelector } from "../../redux/hooks"; import { useEffect } from "react"; +import { selectUsePlatform } from "../../redux/selectors"; +import { PlatformOnboardingCard } from "../OnboardingCard/platform/PlatformOnboardingCard"; +import { OnboardingCard } from "../OnboardingCard"; -interface FreeTrialOverDialogProps { - onConfirm: () => void; - onCancel?: () => void; - text: string; - title?: string; - hideCancelButton?: boolean; - confirmText?: string; -} - -function FreeTrialOverDialog(props: FreeTrialOverDialogProps) { +function FreeTrialOverDialog() { const dispatch = useDispatch(); const history = useAppSelector((store) => store.session.history); + const usePlatform = useAppSelector(selectUsePlatform); useEffect(() => { if (history.length === 0) { @@ -25,40 +18,11 @@ function FreeTrialOverDialog(props: FreeTrialOverDialogProps) { } }, [history]); - return ( -
-

- {props.title ?? "Confirmation"} -

-

- {props.text} -

- -
- {!!props.hideCancelButton || ( - { - dispatch(setShowDialog(false)); - dispatch(setDialogMessage(undefined)); - props.onCancel?.(); - }} - > - Cancel - - )} - -
-
- ); + if (usePlatform) { + return ; + } else { + return ; + } } export default FreeTrialOverDialog; diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 81dbf268c..5c3a18c9a 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -66,13 +66,17 @@ import { getMetaKeyLabel, isMetaEquivalentKeyPressed, } from "../../util"; -import { FREE_TRIAL_LIMIT_REQUESTS } from "../../util/freeTrial"; +import { + FREE_TRIAL_LIMIT_REQUESTS, + incrementFreeTrialCount, +} from "../../util/freeTrial"; import getMultifileEditPrompt from "../../util/getMultifileEditPrompt"; import { getLocalStorage, setLocalStorage } from "../../util/localStorage"; import ConfigErrorIndicator from "./ConfigError"; import { ToolCallDiv } from "./ToolCallDiv"; import { ToolCallButtons } from "./ToolCallDiv/ToolCallButtonsDiv"; import ToolOutput from "./ToolCallDiv/ToolOutput"; +import FreeTrialOverDialog from "../../components/dialogs/FreeTrialOverDialog"; const StopButton = styled.div` background-color: ${vscBackground}; @@ -247,24 +251,20 @@ export function Chat() { editorToClearOnSend?: Editor, ) => { if (defaultModel?.provider === "free-trial") { - dispatch(setDialogMessage()); - dispatch(setShowDialog(true)); - return; - const u = getLocalStorage("ftc") ?? 0; - setLocalStorage("ftc", u + 1); - if (u === FREE_TRIAL_LIMIT_REQUESTS) { + const newCount = incrementFreeTrialCount(); + + if (newCount === FREE_TRIAL_LIMIT_REQUESTS) { posthog?.capture("ftc_reached"); } - if (u >= FREE_TRIAL_LIMIT_REQUESTS) { - if (usePlatform) { - } else { + if (newCount >= FREE_TRIAL_LIMIT_REQUESTS) { + // Card in chat will only show if no history + onboardingCard.open("Quickstart"); + + // If history, show the dialog, which will automatically close if there is not history + if (history.length) { + dispatch(setDialogMessage()); + dispatch(setShowDialog(true)); } - onboardingCard.open("Best"); - ideMessenger.ide.showToast( - "info", - "You've reached the free trial limit. Please configure a model to continue.", - ); - return; } } @@ -304,7 +304,6 @@ export function Chat() { streamResponse, isSingleRangeEditOrInsertion, codeToEdit, - usePlatform, ], ); diff --git a/gui/src/util/freeTrial.ts b/gui/src/util/freeTrial.ts index 83e9ea510..1961fb358 100644 --- a/gui/src/util/freeTrial.ts +++ b/gui/src/util/freeTrial.ts @@ -1,11 +1,13 @@ -import { getLocalStorage } from "./localStorage"; +import { getLocalStorage, setLocalStorage } from "./localStorage"; export const FREE_TRIAL_LIMIT_REQUESTS = 50; -/** - * - * @returns {boolean} true if the user has passed the free trial limit, false otherwise. - */ export function hasPassedFTL(): boolean { return (getLocalStorage("ftc") ?? 0) > FREE_TRIAL_LIMIT_REQUESTS; } + +export function incrementFreeTrialCount(): number { + const u = getLocalStorage("ftc") ?? 0; + setLocalStorage("ftc", u + 1); + return u + 1; +} From 22d84ae726c40d65449c39b2ece4101f32608870 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 21 Jan 2025 11:57:11 -0800 Subject: [PATCH 022/111] feat(jb): add ide logs --- extensions/intellij/.run/IDE Logs.run.xml | 17 +++++++++++++++++ extensions/intellij/.run/Run Continue.run.xml | 1 + extensions/intellij/CONTRIBUTING.md | 9 ++++----- 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 extensions/intellij/.run/IDE Logs.run.xml diff --git a/extensions/intellij/.run/IDE Logs.run.xml b/extensions/intellij/.run/IDE Logs.run.xml new file mode 100644 index 000000000..2743ca662 --- /dev/null +++ b/extensions/intellij/.run/IDE Logs.run.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/extensions/intellij/.run/Run Continue.run.xml b/extensions/intellij/.run/Run Continue.run.xml index 2cc85210f..1366cd39e 100644 --- a/extensions/intellij/.run/Run Continue.run.xml +++ b/extensions/intellij/.run/Run Continue.run.xml @@ -2,6 +2,7 @@ + diff --git a/extensions/intellij/CONTRIBUTING.md b/extensions/intellij/CONTRIBUTING.md index c62084620..26f80ee42 100644 --- a/extensions/intellij/CONTRIBUTING.md +++ b/extensions/intellij/CONTRIBUTING.md @@ -90,10 +90,7 @@ allow for changes to your `config.json` and other files during development, with ### Viewing logs -When using the `Run Continue` task, we automatically run a script that outputs logs into the "Prompt Logs" terminal tab. - -Alternatively, you can view logs for a particular IDE instance by selecting `Help` -> `Open Log in Editor` in the window -toolbar. +When using the `Run Continue` task, we automatically tail both prompt logs and IDE logs. ### Reloading changes @@ -109,7 +106,9 @@ toolbar. - `extensions/intellij`: Breakpoints can be set in Intellij - `gui`: You'll need to set explicit `debugger` statements in the source code, or through the browser dev tools -- `core`: Breakpoints can be set in Intellij (requires restarting the `Start Core Dev Server` task +- `core`: Breakpoints can be set in Intellij (requires restarting the `Start Core Dev Server` task) + - If you have Community Edition installed, you won't be able to use breakpoints in IntelliJ. Instead, you can start + the `Core Binary` task in VS Code and set breakpoints in that IDE. ### Available Gradle tasks From efced3206c1aeed542a0b3ac6e8d798ee4be24f4 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 12:00:03 -0800 Subject: [PATCH 023/111] cleanup --- .../OnboardingCard/platform/tabs/main.tsx | 61 +++++++++++++------ gui/src/pages/gui/Chat.tsx | 11 +++- 2 files changed, 54 insertions(+), 18 deletions(-) diff --git a/gui/src/components/OnboardingCard/platform/tabs/main.tsx b/gui/src/components/OnboardingCard/platform/tabs/main.tsx index f6a14cb93..50e7c99c4 100644 --- a/gui/src/components/OnboardingCard/platform/tabs/main.tsx +++ b/gui/src/components/OnboardingCard/platform/tabs/main.tsx @@ -3,12 +3,16 @@ import { Button, ButtonSubtext } from "../../.."; import { useAuth } from "../../../../context/Auth"; import ContinueLogo from "../../../gui/ContinueLogo"; import { useOnboardingCard } from "../../hooks"; +import { hasPassedFTL } from "../../../../util/freeTrial"; +import { useContext } from "react"; +import { IdeMessengerContext } from "../../../../context/IdeMessenger"; export default function MainTab({ onRemainLocal, }: { onRemainLocal: () => void; }) { + const ideMessenger = useContext(IdeMessengerContext); const onboardingCard = useOnboardingCard(); const auth = useAuth(); @@ -20,30 +24,53 @@ export default function MainTab({ }); } + function openPastFreeTrialOnboarding() { + // NATE TODO - add custom onboarding process handling here + ideMessenger.post("openUrl", "app.continue.dev/onboard?freeTrialStatus=1"); + } + + const pastFreeTrialLimit = hasPassedFTL(); + return (
-

- Log in to quickly build your first custom AI code assistant -

+ {pastFreeTrialLimit ? ( + <> +

+ You've reached the free trial limit. Visit the Continue Platform to + select a Coding Assistant. +

+ + + ) : ( + <> +

+ Log in to quickly build your first custom AI code assistant +

-
- - -
- Or, remain local - -
-
-
+ + + )} + + +
+ Or, remain local + +
+
); } diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 5c3a18c9a..51d06ad7a 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -257,14 +257,23 @@ export function Chat() { posthog?.capture("ftc_reached"); } if (newCount >= FREE_TRIAL_LIMIT_REQUESTS) { + // Show this message whether using platform or not + // So that something happens if in new chat + ideMessenger.ide.showToast( + "error", + "You've reached the free trial limit. Please configure a model to continue.", + ); + // Card in chat will only show if no history - onboardingCard.open("Quickstart"); + // Also, note that platform card ignore the "Best", always opens to main tab + onboardingCard.open("Best"); // If history, show the dialog, which will automatically close if there is not history if (history.length) { dispatch(setDialogMessage()); dispatch(setShowDialog(true)); } + return; } } From 4215559c63f4e990ab018f31e4213877e605126f Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 12:08:17 -0800 Subject: [PATCH 024/111] fix dialog styling --- .../components/OnboardingCard/OnboardingCard.tsx | 2 +- .../OnboardingCard/hooks/useOnboardingCard.ts | 8 -------- .../platform/PlatformOnboardingCard.tsx | 12 ------------ gui/src/components/dialogs/FreeTrialOverDialog.tsx | 14 +++++++++----- 4 files changed, 10 insertions(+), 26 deletions(-) diff --git a/gui/src/components/OnboardingCard/OnboardingCard.tsx b/gui/src/components/OnboardingCard/OnboardingCard.tsx index ed6bbe75b..d6ae03845 100644 --- a/gui/src/components/OnboardingCard/OnboardingCard.tsx +++ b/gui/src/components/OnboardingCard/OnboardingCard.tsx @@ -46,7 +46,7 @@ export function OnboardingCard({ isDialog }: OnboardingCardProps) { return ( store.ui.showDialog); - const [currentTab, setCurrentTab] = useState<"main" | "local">("main"); - // A version of this pops up in a dialog - // so that history doesn't disappear or jump - // If free trial limit is reached mid-chat - if (isPastFreeTrialLimit && isShowingDialog) { - return null; - } - return ( {!isDialog && ( diff --git a/gui/src/components/dialogs/FreeTrialOverDialog.tsx b/gui/src/components/dialogs/FreeTrialOverDialog.tsx index c3718ccc9..d8666b1b2 100644 --- a/gui/src/components/dialogs/FreeTrialOverDialog.tsx +++ b/gui/src/components/dialogs/FreeTrialOverDialog.tsx @@ -18,11 +18,15 @@ function FreeTrialOverDialog() { } }, [history]); - if (usePlatform) { - return ; - } else { - return ; - } + return ( +
+ {usePlatform ? ( + + ) : ( + + )} +
+ ); } export default FreeTrialOverDialog; From 89df3f6e0ec3cdd82716ec9f7839c71e0824985a Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 12:10:15 -0800 Subject: [PATCH 025/111] cleanup onboarding dialog --- core/config/onboarding.ts | 2 +- .../components/OnboardingCard/OnboardingCard.tsx | 2 +- .../OnboardingCard/components/OllamaStatus.tsx | 13 ++++--------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/core/config/onboarding.ts b/core/config/onboarding.ts index f0a506fdf..426a7a4ba 100644 --- a/core/config/onboarding.ts +++ b/core/config/onboarding.ts @@ -9,7 +9,7 @@ export const LOCAL_ONBOARDING_CHAT_MODEL = "llama3.1:8b"; export const LOCAL_ONBOARDING_CHAT_TITLE = "Llama 3.1 8B"; /** - * We set the "best" chat + autocomplete models by default + * We set the "best" chat + autocopmlete models by default * whenever a user doesn't have a config.json */ export function setupBestConfig( diff --git a/gui/src/components/OnboardingCard/OnboardingCard.tsx b/gui/src/components/OnboardingCard/OnboardingCard.tsx index d6ae03845..ed6bbe75b 100644 --- a/gui/src/components/OnboardingCard/OnboardingCard.tsx +++ b/gui/src/components/OnboardingCard/OnboardingCard.tsx @@ -46,7 +46,7 @@ export function OnboardingCard({ isDialog }: OnboardingCardProps) { return ( ( - OllamaConnectionStatuses.WaitingToDownload, + isOllamaConnected + ? OllamaConnectionStatuses.Connected + : OllamaConnectionStatuses.WaitingToDownload, ); - useEffect(() => { - if (isOllamaConnected) { - setStatus(OllamaConnectionStatuses.Connected); - } else if (status !== OllamaConnectionStatuses.Downloading) { - setStatus(OllamaConnectionStatuses.WaitingToDownload); - } - }, [status, isOllamaConnected]); function onClickDownload() { ideMessenger.post("openUrl", downloadUrl); From f67eae4c9d62f335aac70c0c2e52fee30838810a Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 12:30:29 -0800 Subject: [PATCH 026/111] close dialog on submit onboarding --- extensions/vscode/package-lock.json | 4 ++-- .../components/OnboardingCard/OnboardingCard.tsx | 2 +- .../components/QuickStartSubmitButton.tsx | 8 ++++++-- .../OnboardingCard/hooks/useOnboardingCard.ts | 14 +++++++++++--- .../OnboardingCard/hooks/useSubmitOnboarding.ts | 4 ++-- .../platform/PlatformOnboardingCard.tsx | 11 +++++++---- .../OnboardingCard/platform/tabs/main.tsx | 5 ++++- .../OnboardingCard/tabs/OnboardingBestTab.tsx | 8 ++++++-- .../OnboardingCard/tabs/OnboardingLocalTab.tsx | 13 ++++++++++++- .../tabs/OnboardingQuickstartTab.tsx | 8 ++++++-- 10 files changed, 57 insertions(+), 20 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 31f06cbb1..cf132e7ba 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.252", + "version": "0.9.253", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.252", + "version": "0.9.253", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/OnboardingCard/OnboardingCard.tsx b/gui/src/components/OnboardingCard/OnboardingCard.tsx index ed6bbe75b..eebbfb2bc 100644 --- a/gui/src/components/OnboardingCard/OnboardingCard.tsx +++ b/gui/src/components/OnboardingCard/OnboardingCard.tsx @@ -54,7 +54,7 @@ export function OnboardingCard({ isDialog }: OnboardingCardProps) { onTabClick={onboardingCard.setActiveTab} /> {!isDialog && ( - + onboardingCard.close()}> )} diff --git a/gui/src/components/OnboardingCard/components/QuickStartSubmitButton.tsx b/gui/src/components/OnboardingCard/components/QuickStartSubmitButton.tsx index 04eabf345..00d0702c3 100644 --- a/gui/src/components/OnboardingCard/components/QuickStartSubmitButton.tsx +++ b/gui/src/components/OnboardingCard/components/QuickStartSubmitButton.tsx @@ -9,11 +9,15 @@ import { useSubmitOnboarding } from "../hooks"; import JetBrainsFetchGitHubTokenDialog from "./JetBrainsFetchGitHubTokenDialog"; import { setDefaultModel } from "../../../redux/slices/configSlice"; -function QuickstartSubmitButton() { +interface QuickstartSubmitButtonProps { + isDialog?: boolean; +} + +function QuickstartSubmitButton({ isDialog }: QuickstartSubmitButtonProps) { const ideMessenger = useContext(IdeMessengerContext); const dispatch = useDispatch(); - const { submitOnboarding } = useSubmitOnboarding("Quickstart"); + const { submitOnboarding } = useSubmitOnboarding("Quickstart", isDialog); function onComplete() { submitOnboarding(); diff --git a/gui/src/components/OnboardingCard/hooks/useOnboardingCard.ts b/gui/src/components/OnboardingCard/hooks/useOnboardingCard.ts index dfc02f65b..9622754c4 100644 --- a/gui/src/components/OnboardingCard/hooks/useOnboardingCard.ts +++ b/gui/src/components/OnboardingCard/hooks/useOnboardingCard.ts @@ -1,7 +1,11 @@ import { useDispatch } from "react-redux"; import { useNavigate } from "react-router-dom"; import { TabTitle } from "../components/OnboardingCardTabs"; -import { setOnboardingCard } from "../../../redux/slices/uiSlice"; +import { + setDialogMessage, + setOnboardingCard, + setShowDialog, +} from "../../../redux/slices/uiSlice"; import { OnboardingCardState } from ".."; import { getLocalStorage, setLocalStorage } from "../../../util/localStorage"; import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; @@ -12,7 +16,7 @@ export interface UseOnboardingCard { activeTab: OnboardingCardState["activeTab"]; setActiveTab: (tab: TabTitle) => void; open: (tab: TabTitle) => void; - close: () => void; + close: (isDialog?: boolean) => void; } export function useOnboardingCard(): UseOnboardingCard { @@ -41,9 +45,13 @@ export function useOnboardingCard(): UseOnboardingCard { dispatch(setOnboardingCard({ show: true, activeTab: tab })); } - function close() { + function close(isDialog = false) { setLocalStorage("hasDismissedOnboardingCard", true); dispatch(setOnboardingCard({ show: false })); + if (isDialog) { + dispatch(setDialogMessage(undefined)); + dispatch(setShowDialog(false)); + } } function setActiveTab(tab: TabTitle) { diff --git a/gui/src/components/OnboardingCard/hooks/useSubmitOnboarding.ts b/gui/src/components/OnboardingCard/hooks/useSubmitOnboarding.ts index a0407c171..93b24ea91 100644 --- a/gui/src/components/OnboardingCard/hooks/useSubmitOnboarding.ts +++ b/gui/src/components/OnboardingCard/hooks/useSubmitOnboarding.ts @@ -6,7 +6,7 @@ import { OnboardingModes } from "core/protocol/core"; import { useTutorialCard } from "../../../hooks/useTutorialCard"; import { useOnboardingCard } from "./useOnboardingCard"; -export function useSubmitOnboarding(mode: OnboardingModes) { +export function useSubmitOnboarding(mode: OnboardingModes, isDialog = false) { const posthog = usePostHog(); const ideMessenger = useContext(IdeMessengerContext); const { openTutorialCard } = useTutorialCard(); @@ -16,7 +16,7 @@ export function useSubmitOnboarding(mode: OnboardingModes) { const onboardingStatus = getLocalStorage("onboardingStatus"); // Always close the onboarding card and update config.json - closeOnboardingCard(); + closeOnboardingCard(isDialog); ideMessenger.post("completeOnboarding", { mode, }); diff --git a/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx index 2c2a2993a..ede9295b3 100644 --- a/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx +++ b/gui/src/components/OnboardingCard/platform/PlatformOnboardingCard.tsx @@ -24,7 +24,7 @@ export interface OnboardingCardState { } interface OnboardingCardProps { - isDialog?: boolean; + isDialog: boolean; } export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) { @@ -39,14 +39,17 @@ export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) { return ( {!isDialog && ( - + onboardingCard.close()}> )}
diff --git a/gui/src/components/OnboardingCard/platform/tabs/main.tsx b/gui/src/components/OnboardingCard/platform/tabs/main.tsx index 50e7c99c4..e67e0b990 100644 --- a/gui/src/components/OnboardingCard/platform/tabs/main.tsx +++ b/gui/src/components/OnboardingCard/platform/tabs/main.tsx @@ -9,8 +9,10 @@ import { IdeMessengerContext } from "../../../../context/IdeMessenger"; export default function MainTab({ onRemainLocal, + isDialog, }: { onRemainLocal: () => void; + isDialog: boolean; }) { const ideMessenger = useContext(IdeMessengerContext); const onboardingCard = useOnboardingCard(); @@ -19,7 +21,7 @@ export default function MainTab({ function onGetStarted() { auth.login(true).then((success) => { if (success) { - onboardingCard.close(); + onboardingCard.close(isDialog); } }); } @@ -27,6 +29,7 @@ export default function MainTab({ function openPastFreeTrialOnboarding() { // NATE TODO - add custom onboarding process handling here ideMessenger.post("openUrl", "app.continue.dev/onboard?freeTrialStatus=1"); + onboardingCard.close(isDialog); } const pastFreeTrialLimit = hasPassedFTL(); diff --git a/gui/src/components/OnboardingCard/tabs/OnboardingBestTab.tsx b/gui/src/components/OnboardingCard/tabs/OnboardingBestTab.tsx index f4c02cefd..17d2ead00 100644 --- a/gui/src/components/OnboardingCard/tabs/OnboardingBestTab.tsx +++ b/gui/src/components/OnboardingCard/tabs/OnboardingBestTab.tsx @@ -2,8 +2,12 @@ import BestExperienceConfigForm from "../components/BestExperienceConfigForm"; import ProviderAlert from "../components/ProviderAlert"; import { useSubmitOnboarding } from "../hooks"; -function OnboardingBestTab() { - const { submitOnboarding } = useSubmitOnboarding("Best"); +interface OnboardingBestTabProps { + isDialog?: boolean; +} + +function OnboardingBestTab({ isDialog }: OnboardingBestTabProps) { + const { submitOnboarding } = useSubmitOnboarding("Best", isDialog); return (
diff --git a/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx b/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx index 71b4a13ac..76ba5bf5c 100644 --- a/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx +++ b/gui/src/components/OnboardingCard/tabs/OnboardingLocalTab.tsx @@ -14,14 +14,20 @@ import OllamaModelDownload from "../components/OllamaModelDownload"; import { OllamaStatus } from "../components/OllamaStatus"; import { useSubmitOnboarding } from "../hooks"; import { setDefaultModel } from "../../../redux/slices/configSlice"; +import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice"; const OLLAMA_CHECK_INTERVAL_MS = 3000; -function OnboardingLocalTab() { +interface OnboardingLocalTabProps { + isDialog?: boolean; +} + +function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) { const dispatch = useDispatch(); const ideMessenger = useContext(IdeMessengerContext); const { submitOnboarding } = useSubmitOnboarding( hasPassedFTL() ? "LocalAfterFreeTrial" : "Local", + isDialog, ); const [hasLoadedChatModel, setHasLoadedChatModel] = useState(false); const [downloadedOllamaModels, setDownloadedOllamaModels] = useState< @@ -117,6 +123,11 @@ function OnboardingLocalTab() { onClick={() => { submitOnboarding(); + if (isDialog) { + dispatch(setDialogMessage(undefined)); + dispatch(setShowDialog(false)); + } + // Set the selected model to the local chat model dispatch( setDefaultModel({ diff --git a/gui/src/components/OnboardingCard/tabs/OnboardingQuickstartTab.tsx b/gui/src/components/OnboardingCard/tabs/OnboardingQuickstartTab.tsx index 326fd32e2..f291cf7c8 100644 --- a/gui/src/components/OnboardingCard/tabs/OnboardingQuickstartTab.tsx +++ b/gui/src/components/OnboardingCard/tabs/OnboardingQuickstartTab.tsx @@ -1,7 +1,11 @@ import ContinueLogo from "../../gui/ContinueLogo"; import QuickStartSubmitButton from "../components/QuickStartSubmitButton"; -function OnboardingQuickstartTab() { +interface OnboardingQuickstartTabProps { + isDialog?: boolean; +} + +function OnboardingQuickstartTab({ isDialog }: OnboardingQuickstartTabProps) { return (
@@ -18,7 +22,7 @@ function OnboardingQuickstartTab() { To prevent abuse, we'll ask you to sign in to GitHub.

- +
); From ec9702be9945288b90b01dbbf28efa9fd9a82b1f Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 12:41:02 -0800 Subject: [PATCH 027/111] clean up onboarding tabs --- extensions/vscode/package-lock.json | 6 ++--- .../OnboardingCard/platform/tabs/local.tsx | 26 ------------------- 2 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 gui/src/components/OnboardingCard/platform/tabs/local.tsx diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index cf132e7ba..38d0db7c8 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.253", + "version": "0.9.254", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.253", + "version": "0.9.254", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", @@ -106,7 +106,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.621.0", "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.11", + "@continuedev/config-yaml": "^1.0.16", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/gui/src/components/OnboardingCard/platform/tabs/local.tsx b/gui/src/components/OnboardingCard/platform/tabs/local.tsx deleted file mode 100644 index ae30085ec..000000000 --- a/gui/src/components/OnboardingCard/platform/tabs/local.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { useAuth } from "../../../../context/Auth"; -import ContinueLogo from "../../../gui/ContinueLogo"; -import { useOnboardingCard } from "../../hooks"; - -export default function LocalTab() { - const onboardingCard = useOnboardingCard(); - const auth = useAuth(); - - return ( -
-
- -
- -

- Log in to quickly build your first custom AI code assistant -

- - {/*

- To prevent abuse, we'll ask you to sign in to GitHub. -

*/} - -
-
- ); -} From 1c299dad18ae9e70834070420f2dd77476146db8 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 13:03:35 -0800 Subject: [PATCH 028/111] controlPlane/openUrl message --- core/core.ts | 8 ++++++++ core/protocol/core.ts | 1 + core/protocol/passThrough.ts | 1 + .../continueintellijextension/constants/MessageTypes.kt | 1 + extensions/vscode/package-lock.json | 6 +++--- gui/src/components/OnboardingCard/platform/tabs/main.tsx | 5 +++-- .../modelSelection/platform/AssistantSelect.tsx | 4 +++- 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/core/core.ts b/core/core.ts index c74f2e539..88f480753 100644 --- a/core/core.ts +++ b/core/core.ts @@ -55,6 +55,7 @@ import { import { usePlatform } from "./control-plane/flags"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import type { IMessenger, Message } from "./protocol/messenger"; +import { controlPlaneEnv } from "./control-plane/env"; export class Core { // implements IMessenger @@ -294,6 +295,13 @@ export class Core { addContextProvider(msg.data); }); + on("controlPlane/openUrl", async (msg) => { + await this.messenger.request( + "openUrl", + `${controlPlaneEnv.APP_URL}${msg.data.path}`, + ); + }); + // Context providers on("context/addDocs", async (msg) => { void this.docsService.indexAndAdd(msg.data); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index b48b11398..52cffb027 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -191,4 +191,5 @@ export type ToCoreFromIdeOrWebviewProtocol = { { contextItems: ContextItem[] }, ]; "clipboardCache/add": [{ content: string }, void]; + "controlPlane/openUrl": [{ path: string }, void]; }; diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index a638eafb4..3d871c42a 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -58,6 +58,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "profiles/switch", "didChangeSelectedProfile", "tools/call", + "controlPlane/openUrl", ]; // Message types to pass through from core to webview diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt index cf7af5f7c..4b685806b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt @@ -123,6 +123,7 @@ class MessageTypes { "profiles/switch", "didChangeSelectedProfile", "tools/call", + "controlPlane/openUrl" ) } } \ No newline at end of file diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 38d0db7c8..cf132e7ba 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.254", + "version": "0.9.253", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.254", + "version": "0.9.253", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", @@ -106,7 +106,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.621.0", "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.16", + "@continuedev/config-yaml": "^1.0.11", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/gui/src/components/OnboardingCard/platform/tabs/main.tsx b/gui/src/components/OnboardingCard/platform/tabs/main.tsx index e67e0b990..94e3c0de0 100644 --- a/gui/src/components/OnboardingCard/platform/tabs/main.tsx +++ b/gui/src/components/OnboardingCard/platform/tabs/main.tsx @@ -27,8 +27,9 @@ export default function MainTab({ } function openPastFreeTrialOnboarding() { - // NATE TODO - add custom onboarding process handling here - ideMessenger.post("openUrl", "app.continue.dev/onboard?freeTrialStatus=1"); + ideMessenger.post("controlPlane/openUrl", { + path: "setup-models", + }); onboardingCard.close(isDialog); } diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx index 383c50f1e..972dd2782 100644 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantSelect.tsx @@ -25,7 +25,9 @@ export function AssistantSelect(props: AssistantSelectProps) { const dispatch = useAppDispatch(); function onNewAssistant() { - ideMessenger.post("openUrl", "https://app-test.continue.dev/new"); + ideMessenger.post("controlPlane/openUrl", { + path: "new", + }); } return ( From 87c0f343850325b15ae3953c45fb948bcd6e29a5 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 13:06:01 -0800 Subject: [PATCH 029/111] revert package lock --- extensions/vscode/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index cf132e7ba..38d0db7c8 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.253", + "version": "0.9.254", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.253", + "version": "0.9.254", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", @@ -106,7 +106,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.621.0", "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.11", + "@continuedev/config-yaml": "^1.0.16", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", From 156301d213678dc6aa48fc4bec25ead3b525fd5a Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 13:12:07 -0800 Subject: [PATCH 030/111] padding between images --- gui/src/components/mainInput/TipTapEditor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index cde2975b7..232dafae3 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -350,7 +350,7 @@ function TipTapEditor(props: TipTapEditorProps) { }, }).configure({ HTMLAttributes: { - class: "object-contain max-h-[210px] max-w-full", + class: "object-contain max-h-[210px] max-w-full mx-1", }, }), Placeholder.configure({ From 5bf984561301228875ae312ae49d1daeebb87975 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 21 Jan 2025 14:10:54 -0800 Subject: [PATCH 031/111] Update InlineEditAction.kt --- .../continueintellijextension/editor/InlineEditAction.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt index ce2c260e1..6139799bd 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -130,7 +130,8 @@ fun openInlineEdit(project: Project?, editor: Editor) { val modelTitles = mutableListOf() continuePluginService.coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response -> - val result = (response as Map)["result"] as Map + val content = (response as Map)["content"] as Map + val result = content["result"] as Map val config = result["config"] as Map val models = config["models"] as List> modelTitles.addAll(models.map { it["title"] as String }) From 794a8f0c9ea2121ef0b9112fc97fab46806d4f19 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 14:28:27 -0800 Subject: [PATCH 032/111] ide message content --- .../continueintellijextension/continue/IdeProtocolClient.kt | 6 ++++-- 1 file changed, 4 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 ad70dd147..0a0b6b83a 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 @@ -439,8 +439,11 @@ class IdeProtocolClient( null, null ) { response -> - val result = (response as Map)["result"] as Map + val responseObject = response as Map<*, *> + val responseContent = responseObject["content"] as Map<*, *> + val result = responseContent["result"] as Map<*, *> val config = result["config"] as Map + val applyCodeBlockModel = getModelByRole(config, "applyCodeBlock") if (applyCodeBlockModel != null) { @@ -451,7 +454,6 @@ class IdeProtocolClient( config["models"] as List> val curSelectedModel = models.find { it["title"] == params.curSelectedModelTitle } -// continuation.resume(curSelectedModel) if (curSelectedModel == null) { return@request } else { From a304f3e3c1df1651922f833feec6c4695d397e10 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 14:41:40 -0800 Subject: [PATCH 033/111] handle additional config message --- .../continue/CoreMessengerManager.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt index 73a707f80..0ce128e5b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt @@ -59,8 +59,11 @@ class CoreMessengerManager( coreMessenger = CoreMessenger(project, continueCorePath, ideProtocolClient, coroutineScope) coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response -> - val result = (response as Map)["result"] as Map + val responseObject = response as Map<*, *> + val responseContent = responseObject["content"] as Map<*, *> + val result = responseContent["result"] as Map<*, *> val config = result["config"] as Map + val allowAnonymousTelemetry = config?.get("allowAnonymousTelemetry") as? Boolean val telemetryService = service() if (allowAnonymousTelemetry == true || allowAnonymousTelemetry == null) { From f89a9abecee54224a2e305f79a57ab6b4bfdf335 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 14:57:25 -0800 Subject: [PATCH 034/111] fix auth link --- .vscode/launch.json | 1 + binary/package-lock.json | 2 +- core/control-plane/auth/index.ts | 5 +---- .../continueintellijextension/auth/ContinueAuthService.kt | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index cdb502c8c..7a5161729 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -38,6 +38,7 @@ "internalConsoleOptions": "openOnSessionStart", "cwd": "${workspaceFolder}/binary", "env": { + // "CONTROL_PLANE_ENV": "test", "CONTINUE_DEVELOPMENT": "true", "CONTINUE_GLOBAL_DIR": "${workspaceFolder}/extensions/.continue-debug" } diff --git a/binary/package-lock.json b/binary/package-lock.json index 89ecc53cc..316fddcd2 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -48,7 +48,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.621.0", "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.10", + "@continuedev/config-yaml": "^1.0.16", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/core/control-plane/auth/index.ts b/core/control-plane/auth/index.ts index c1a6f881d..f7d423f83 100644 --- a/core/control-plane/auth/index.ts +++ b/core/control-plane/auth/index.ts @@ -2,14 +2,11 @@ import { v4 as uuidv4 } from "uuid"; import { controlPlaneEnv } from "../env"; -const CLIENT_ID = "client_01J0FW6XN8N2XJAECF7NE0Y65J"; -// const CLIENT_ID = "client_01J0FW6XCPMJMQ3CG51RB4HBZQ"; // Staging - export async function getAuthUrlForTokenPage(): Promise { const url = new URL("https://api.workos.com/user_management/authorize"); const params = { response_type: "code", - client_id: CLIENT_ID, + client_id: controlPlaneEnv.WORKOS_CLIENT_ID, redirect_uri: `${controlPlaneEnv.APP_URL}tokens/callback`, // redirect_uri: "http://localhost:3000/tokens/callback", state: uuidv4(), diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt index 22178004e..d23308cf1 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt @@ -135,7 +135,7 @@ class ContinueAuthService { private fun openSignInPage(project: Project) { val coreMessenger = project.service().coreMessenger coreMessenger?.request("auth/getAuthUrl", null, null) { response -> - val authUrl = (response as? Map<*, *>)?.get("url") as? String + val authUrl = ((response as? Map<*, *>)?.get("content") as? Map<*, *>)?.get("url") as? String if (authUrl != null) { // Open the auth URL in the browser Desktop.getDesktop().browse(java.net.URI(authUrl)) From c929865f6cf16b51f3faa6d32a132f203fb87947 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:10:08 -0800 Subject: [PATCH 035/111] pr_checks require all --- .github/workflows/pr_checks.yaml | 48 +++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index f629f9331..5edabf18c 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -97,7 +97,7 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} install-gui: - needs: [ install-root, install-core ] + needs: [install-root, install-core] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -158,7 +158,7 @@ jobs: npx tsc --noEmit binary-checks: - needs: [ install-root, install-core ] + needs: [install-root, install-core] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -194,7 +194,7 @@ jobs: npx tsc --noEmit install-vscode: - needs: [ install-root, install-core ] + needs: [install-root, install-core] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -283,7 +283,7 @@ jobs: vscode-get-test-file-matrix: runs-on: ubuntu-latest - needs: [ install-root, install-vscode ] + needs: [install-root, install-vscode] outputs: test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} steps: @@ -312,7 +312,7 @@ jobs: vscode-package-extension: runs-on: ubuntu-latest - needs: [ install-vscode, install-core ] + needs: [install-vscode, install-core] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -344,7 +344,7 @@ jobs: vscode-download-e2e-dependencies: runs-on: ubuntu-latest - needs: [ install-vscode, install-core ] + needs: [install-vscode, install-core] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -390,7 +390,7 @@ jobs: fail-fast: false matrix: test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }} - command: [ "e2e:ci:run", "e2e:ci:run-yaml" ] + command: ["e2e:ci:run", "e2e:ci:run-yaml"] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -451,7 +451,7 @@ jobs: path: extensions/vscode/e2e/storage/screenshots gui-tests: - needs: [ install-gui, install-core ] + needs: [install-gui, install-core] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -482,7 +482,7 @@ jobs: npm test jetbrains-tests: - needs: [ install-root, core-checks ] + needs: [install-root, core-checks] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -578,4 +578,32 @@ jobs: with: name: jb-failure-report path: | - ${{ github.workspace }}/extensions/intellij/build/reports \ No newline at end of file + ${{ github.workspace }}/extensions/intellij/build/reports + + check: + if: always() + runs-on: ubuntu-latest + needs: + - install-root + - install-core + - core-checks + - install-gui + - gui-checks + - binary-checks + - install-vscode + - vscode-checks + - core-tests + - vscode-get-test-file-matrix + - vscode-package-extension + - vscode-download-e2e-dependencies + - vscode-e2e-tests + - gui-tests + - jetbrains-tests + + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + allowed-failures: [] + allowed-skips: [] + jobs: ${{ toJSON(needs) }} From 2260300d6478383aed22ad0e5399964dc2d8ac12 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:12:34 -0800 Subject: [PATCH 036/111] use production environment for core-checks --- .github/workflows/pr_checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 5edabf18c..c01e2fe67 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -70,6 +70,7 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest + environment: production steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From 97309a61faeb9475e3948665073036a7d01389d0 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:14:59 -0800 Subject: [PATCH 037/111] fix syntax --- .github/workflows/pr_checks.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index c01e2fe67..351b4707e 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -605,6 +605,6 @@ jobs: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: - allowed-failures: [] - allowed-skips: [] + allowed-failures: + allowed-skips: jobs: ${{ toJSON(needs) }} From caca9a9612f50f362eee38263380a712a000e3e5 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:22:30 -0800 Subject: [PATCH 038/111] only require approval on forks --- .github/workflows/pr_checks.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 351b4707e..b9db610a8 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -70,8 +70,12 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - environment: production + environment: ${{ github.event.pull_request.head.repo.fork && 'production' || '' }} steps: + - name: Print whether fork + run: | + echo "Fork: ${github.event.pull_request.head.repo.fork}" + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: From e6c44b1f0992eecb89282663e4c313b086a7e67b Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 21 Jan 2025 15:23:16 -0800 Subject: [PATCH 039/111] test: inline edit tests --- .../editor/InlineEditAction.kt | 4 +- .../e2e/InlineEdit.kt | 91 +++++++++++++++++++ 2 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/InlineEdit.kt diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt index 6139799bd..52e784d72 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -167,13 +167,13 @@ fun openInlineEdit(project: Project?, editor: Editor) { val prefix = editor.document.getText(TextRange(0, startOffset)) val highlighted = editor.document.getText(TextRange(startOffset, endOffset)) val suffix = editor.document.getText(TextRange(endOffset, editor.document.textLength)) - val lineNumber = max(0, startLineNumber - 1) + val lineNumber = if (startLineNumber == 0) 0 else max(0, startLineNumber - 1) // Un-highlight the selected text selectionModel.removeSelection() // Get indentation width in pixels - val indentationLineNum = lineNumber + 1 + val indentationLineNum = if (startLineNumber == 0) 0 else lineNumber + 1 val lineStart = editor.document.getLineStartOffset(indentationLineNum) val lineEnd = editor.document.getLineEndOffset(indentationLineNum) val text = editor.document.getText(TextRange(lineStart, lineEnd)) diff --git a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/InlineEdit.kt b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/InlineEdit.kt new file mode 100644 index 000000000..e43203810 --- /dev/null +++ b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/InlineEdit.kt @@ -0,0 +1,91 @@ +package com.github.continuedev.continueintellijextension.e2e + +import com.automation.remarks.junit5.Video +import com.github.continuedev.continueintellijextension.fixtures.dialog +import com.github.continuedev.continueintellijextension.fixtures.idea +import com.github.continuedev.continueintellijextension.fixtures.welcomeFrame +import com.github.continuedev.continueintellijextension.utils.RemoteRobotExtension +import com.github.continuedev.continueintellijextension.utils.StepsLogger +import com.github.continuedev.continueintellijextension.utils.getMetaKey +import com.intellij.remoterobot.RemoteRobot +import com.intellij.remoterobot.fixtures.ComponentFixture +import com.intellij.remoterobot.search.locators.byXpath +import com.intellij.remoterobot.steps.CommonSteps +import com.intellij.remoterobot.utils.keyboard +import com.intellij.remoterobot.utils.waitFor +import com.intellij.remoterobot.utils.waitForIgnoringError +import org.junit.jupiter.api.AfterEach +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith +import java.awt.event.KeyEvent +import java.awt.event.KeyEvent.VK_I +import java.awt.event.KeyEvent.VK_J +import java.time.Duration.ofMinutes +import java.time.Duration.ofSeconds + +@ExtendWith(RemoteRobotExtension::class) +class InlineEdit { + init { + StepsLogger.init() + } + + @BeforeEach + fun waitForIde(remoteRobot: RemoteRobot) { + waitForIgnoringError(ofMinutes(3)) { remoteRobot.callJs("true") } + } + + @AfterEach + fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject() + + @Test + @Video + fun submitInlineEdit(remoteRobot: RemoteRobot): Unit = with(remoteRobot) { + welcomeFrame { + createNewProjectLink.click() + dialog("New Project") { + findText("Java").click() + checkBox("Add sample code").select() + button("Create").click() + } + } + + // Wait for the default "Main.java" tab to load + // Our "continue_tutorial.java.ft" tab loads first, but then "Main.java" takes focus. + waitFor(ofSeconds(20)) { + findAll( + byXpath("//div[@accessiblename='Main.java' and @class='SingleHeightLabel']") + ).isNotEmpty() + } + + idea { + with(textEditor()) { + val userMsg = "TEST_USER_MESSAGE_0" + editor.insertTextAtLine(0, 0, userMsg) + editor.selectText(userMsg) + + keyboard { + hotKey(getMetaKey(), VK_I) + } + + val textArea = find(byXpath("//div[@class='CustomTextArea']")) + textArea.hasText("Enter instructions...") + + val modelSelect = find(byXpath("//div[@class='JComboBox']")) + modelSelect.hasText("TEST LLM") + + keyboard { + enterText("Hello world!") + } + + val enterBtn = find(byXpath("//div[@class='CustomButton']")) + enterBtn.click() + + find(byXpath("//div[@text='⌥⇧N']")).isShowing + find(byXpath("//div[@text='⌥⇧Y']")).isShowing + find(byXpath("//div[@text='Accept All (⌘⇧⏎)']")).isShowing + find(byXpath("//div[@text='Reject All (⌘⇧⌫)']")).isShowing + } + } + } +} \ No newline at end of file From 4955a6fa1a58745bcd83d281489111f2faf775f6 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:24:09 -0800 Subject: [PATCH 040/111] fix syntax --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index b9db610a8..483b782c0 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -74,7 +74,7 @@ jobs: steps: - name: Print whether fork run: | - echo "Fork: ${github.event.pull_request.head.repo.fork}" + echo "Fork: ${{ github.event.pull_request.head.repo.fork }}" - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From c236b6c87c93dd720acaaad87d3f5cc5022587ae Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:39:31 -0800 Subject: [PATCH 041/111] rename --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 483b782c0..e93302d09 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -585,7 +585,7 @@ jobs: path: | ${{ github.workspace }}/extensions/intellij/build/reports - check: + require-all-checks-to-pass: if: always() runs-on: ubuntu-latest needs: From ad9ca84af4bcfdbd8fe30821dcab067e2d926512 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 21 Jan 2025 15:47:52 -0800 Subject: [PATCH 042/111] Update InlineEdit.kt --- .../continueintellijextension/e2e/InlineEdit.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/InlineEdit.kt b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/InlineEdit.kt index e43203810..d153deda5 100644 --- a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/InlineEdit.kt +++ b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/e2e/InlineEdit.kt @@ -6,7 +6,7 @@ import com.github.continuedev.continueintellijextension.fixtures.idea import com.github.continuedev.continueintellijextension.fixtures.welcomeFrame import com.github.continuedev.continueintellijextension.utils.RemoteRobotExtension import com.github.continuedev.continueintellijextension.utils.StepsLogger -import com.github.continuedev.continueintellijextension.utils.getMetaKey +import com.github.continuedev.continueintellijextension.utils.* import com.intellij.remoterobot.RemoteRobot import com.intellij.remoterobot.fixtures.ComponentFixture import com.intellij.remoterobot.search.locators.byXpath @@ -18,9 +18,7 @@ import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -import java.awt.event.KeyEvent import java.awt.event.KeyEvent.VK_I -import java.awt.event.KeyEvent.VK_J import java.time.Duration.ofMinutes import java.time.Duration.ofSeconds @@ -81,10 +79,15 @@ class InlineEdit { val enterBtn = find(byXpath("//div[@class='CustomButton']")) enterBtn.click() - find(byXpath("//div[@text='⌥⇧N']")).isShowing - find(byXpath("//div[@text='⌥⇧Y']")).isShowing - find(byXpath("//div[@text='Accept All (⌘⇧⏎)']")).isShowing - find(byXpath("//div[@text='Reject All (⌘⇧⌫)']")).isShowing + val rejectText = "${getAltKeyLabel()}${getShiftKeyLabel()}N" + val acceptText = "${getAltKeyLabel()}${getShiftKeyLabel()}Y" + val acceptAllText = "Accept All (${getMetaKeyLabel()}${getShiftKeyLabel()}⏎)" + val rejectAllText = "Reject All (${getMetaKeyLabel()}${getShiftKeyLabel()}⌫)" + + find(byXpath("//div[@text='$rejectText']")).isShowing + find(byXpath("//div[@text='$acceptText']")).isShowing + find(byXpath("//div[@text='$acceptAllText']")).isShowing + find(byXpath("//div[@text='$rejectAllText']")).isShowing } } } From b729174dff8cb8d172e23b0256abffa0fb54c106 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:57:00 -0800 Subject: [PATCH 043/111] change env --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index e93302d09..e94065589 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -70,7 +70,7 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - environment: ${{ github.event.pull_request.head.repo.fork && 'production' || '' }} + environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} steps: - name: Print whether fork run: | From 32cf97f3ba9a80cd6d3a6c1e3403ff4307a5baef Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 21 Jan 2025 15:57:20 -0800 Subject: [PATCH 044/111] Update InlineEditAction.kt --- .../continueintellijextension/editor/InlineEditAction.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt index 52e784d72..9f314ede6 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -4,6 +4,7 @@ import com.github.continuedev.continueintellijextension.`continue`.GetTheme import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService import com.github.continuedev.continueintellijextension.utils.getMetaKeyLabel +import com.github.continuedev.continueintellijextension.utils.getShiftKeyLabel import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction @@ -489,14 +490,14 @@ class CustomPanel( } val leftButton = - CustomButton("Reject All (${getMetaKeyLabel()}⇧⌫)") { onReject() } + CustomButton("Reject All (${getMetaKeyLabel()}${getShiftKeyLabel()}⌫)") { onReject() } .apply { background = JBColor(0x30FF0000.toInt(), 0x30FF0000.toInt()) foreground = JBColor(0xF5F5F5.toInt(), 0xF5F5F5.toInt()) } val rightButton = - CustomButton("Accept All (${getMetaKeyLabel()}⇧⏎)") { onAccept() } + CustomButton("Accept All (${getMetaKeyLabel()}${getShiftKeyLabel()}⏎)") { onAccept() } .apply { background = JBColor(0x3000FF00.toInt(), 0x3000FF00.toInt()) foreground = JBColor(0xF5F5F5.toInt(), 0xF5F5F5.toInt()) From 105bb380349e603467449c3f0d8b7016d5bed767 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 16:05:58 -0800 Subject: [PATCH 045/111] add comments and require environment at the top of the file --- .github/workflows/pr_checks.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index e94065589..1e080a2d7 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -21,6 +21,9 @@ on: - "gui/**" - ".github/workflows/**" +# Tests requiring secrets need approval from maintainers +environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} + jobs: install-root: runs-on: ubuntu-latest @@ -70,7 +73,6 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} steps: - name: Print whether fork run: | @@ -399,8 +401,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" + with: node-version-k - uses: actions/cache@v4 id: vscode-node-modules-cache @@ -585,6 +586,9 @@ jobs: path: | ${{ github.workspace }}/extensions/intellij/build/reports + # GitHub does not have a way of requiring that all checks pass (you must manually select each job) + # This action at least lets us manage the list of required tests via source control + # so that creators of new jobs can add them to this list require-all-checks-to-pass: if: always() runs-on: ubuntu-latest From 06b3cb35a0b7d51152f0b75a051c5ada5aaba135 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 17:03:28 -0800 Subject: [PATCH 046/111] fix syntax error --- .github/workflows/pr_checks.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 1e080a2d7..9b5a858f8 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -21,9 +21,6 @@ on: - "gui/**" - ".github/workflows/**" -# Tests requiring secrets need approval from maintainers -environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} - jobs: install-root: runs-on: ubuntu-latest @@ -73,11 +70,9 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest + # Tests requiring secrets need approval from maintainers + environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} steps: - - name: Print whether fork - run: | - echo "Fork: ${{ github.event.pull_request.head.repo.fork }}" - - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: @@ -393,6 +388,8 @@ jobs: install-core, ] runs-on: ubuntu-latest + # Tests requiring secrets need approval from maintainers + environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} strategy: fail-fast: false matrix: From 23c595cf3d649a088f4e8832253ae0bdddadedf3 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 17:06:49 -0800 Subject: [PATCH 047/111] fix syntax again --- .github/workflows/pr_checks.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 9b5a858f8..81fb93701 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -398,7 +398,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 - with: node-version-k + with: + node-version-file: ".nvmrc" - uses: actions/cache@v4 id: vscode-node-modules-cache From 11c10639c9738c8557cdbbfe46f27ca22221f717 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 17:38:42 -0800 Subject: [PATCH 048/111] remove enabledebuglogs --- core/config/types.ts | 1 - core/index.d.ts | 1 - .../continueintellijextension/continue/IntelliJIde.kt | 1 - .../com/github/continuedev/continueintellijextension/types.kt | 1 - extensions/vscode/src/VsCodeIde.ts | 1 - 5 files changed, 5 deletions(-) diff --git a/core/config/types.ts b/core/config/types.ts index 6d2847c11..ee23ba49b 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -572,7 +572,6 @@ declare global { userToken: string; enableControlServerBeta: boolean; pauseCodebaseIndexOnStart: boolean; - enableDebugLogs: boolean; } export interface IDE { diff --git a/core/index.d.ts b/core/index.d.ts index 7f98129f2..ab7436b6c 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -584,7 +584,6 @@ export interface IdeSettings { userToken: string; enableControlServerBeta: boolean; pauseCodebaseIndexOnStart: boolean; - enableDebugLogs: boolean; } export interface FileStats { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt index d30a5d5fe..f871fc69e 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt @@ -94,7 +94,6 @@ class IntelliJIDE( userToken = settings.continueState.userToken ?: "", enableControlServerBeta = settings.continueState.enableContinueTeamsBeta, pauseCodebaseIndexOnStart = false, // TODO: Needs to be implemented - enableDebugLogs = false // TODO: Needs to be implemented ) } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt index 1400e5c54..201b259de 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt @@ -88,7 +88,6 @@ data class IdeSettings( val userToken: String, val enableControlServerBeta: Boolean, val pauseCodebaseIndexOnStart: Boolean, - val enableDebugLogs: Boolean ) data class ContinueRcJson( diff --git a/extensions/vscode/src/VsCodeIde.ts b/extensions/vscode/src/VsCodeIde.ts index 51008db8a..4cf619a3e 100644 --- a/extensions/vscode/src/VsCodeIde.ts +++ b/extensions/vscode/src/VsCodeIde.ts @@ -640,7 +640,6 @@ class VsCodeIde implements IDE { "pauseCodebaseIndexOnStart", false, ), - enableDebugLogs: false, // settings.get( // "enableControlServerBeta", // false, From 6c73ad2924bd7e1dca5e730ae44a7941e37410dc Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 21 Jan 2025 17:38:57 -0800 Subject: [PATCH 049/111] remove enabledebuglogs p2 --- core/indexing/docs/DocsService.skip.ts | 1 - core/util/filesystem.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/core/indexing/docs/DocsService.skip.ts b/core/indexing/docs/DocsService.skip.ts index 6f9853afe..a57906012 100644 --- a/core/indexing/docs/DocsService.skip.ts +++ b/core/indexing/docs/DocsService.skip.ts @@ -45,7 +45,6 @@ describe.skip("DocsService Integration Tests", () => { enableControlServerBeta: false, pauseCodebaseIndexOnStart: false, ideSettings: {} as any, - enableDebugLogs: false, remoteConfigServerUrl: "", }), async () => {}, diff --git a/core/util/filesystem.ts b/core/util/filesystem.ts index ccb550ec9..f414a324b 100644 --- a/core/util/filesystem.ts +++ b/core/util/filesystem.ts @@ -54,7 +54,6 @@ class FileSystemIde implements IDE { userToken: "", enableControlServerBeta: false, pauseCodebaseIndexOnStart: false, - enableDebugLogs: false, }; } async getGitHubAuthToken(args: GetGhTokenArgs): Promise { From 8559dce67d8d42c0621e6cad17ddc931c8fbc461 Mon Sep 17 00:00:00 2001 From: GoldR0 <151916999+GoldR0@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:32:13 +0200 Subject: [PATCH 050/111] Update CONTRIBUTING.md Improved readability by adding missing periods (.) in multiple places. --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca26d38fe..b69b1fd44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,7 +49,7 @@ If you find a bug, please [create an issue](https://github.com/continuedev/conti ## ✨ Suggest Enhancements -Continue is quickly adding features, and we'd love to hear which are the most important to you. The best ways to suggest an enhancement are +Continue is quickly adding features, and we'd love to hear which are the most important to you. The best ways to suggest an enhancement are: - Create an issue @@ -192,7 +192,7 @@ Continue has support for more than a dozen different LLM "providers", making it 1. Create a new file in the `core/llm/llms` directory. The name of the file should be the name of the provider, and it should export a class that extends `BaseLLM`. This class should contain the following minimal implementation. We recommend viewing pre-existing providers for more details. The [LlamaCpp Provider](./core/llm/llms/LlamaCpp.ts) is a good simple example. -- `providerName` - the identifier for your provider +- `providerName` - the identifier for your provider. - At least one of `_streamComplete` or `_streamChat` - This is the function that makes the request to the API and returns the streamed response. You only need to implement one because Continue can automatically convert between "chat" and "raw completion". 2. Add your provider to the `LLMs` array in [core/llm/llms/index.ts](./core/llm/llms/index.ts). From 17a976538714de453aaf78e6a94eba3f37b4dbe6 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 22 Jan 2025 10:31:01 -0800 Subject: [PATCH 051/111] remove getChatTitles --- core/config/load.ts | 13 ++++++++----- core/config/types.ts | 1 - core/index.d.ts | 1 - docs/docs/reference.md | 2 ++ gui/src/redux/thunks/session.ts | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index 689f53ca5..c1c3c4261 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -135,11 +135,14 @@ function loadSerializedConfig( config.allowAnonymousTelemetry = true; } - if (config.ui?.getChatTitles === undefined) { - config.ui = { - ...config.ui, - getChatTitles: true, - }; + // Deprecated getChatTitles property should be accounted for + // This is noted in docs + if ( + config.ui && + "getChatTitles" in config.ui && + config.ui.getChatTitles === false + ) { + config.disableSessionTitles = true; } if (ideSettings.remoteConfigServerUrl) { diff --git a/core/config/types.ts b/core/config/types.ts index e5797bdb7..269ae0e12 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -947,7 +947,6 @@ declare global { fontSize?: number; displayRawMarkdown?: boolean; showChatScrollbar?: boolean; - getChatTitles?: boolean; codeWrap?: boolean; } diff --git a/core/index.d.ts b/core/index.d.ts index 63847aa14..a8b423bfd 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -986,7 +986,6 @@ export interface ContinueUIConfig { fontSize?: number; displayRawMarkdown?: boolean; showChatScrollbar?: boolean; - getChatTitles?: boolean; codeWrap?: boolean; } diff --git a/docs/docs/reference.md b/docs/docs/reference.md index d3c491f4c..8e2265d59 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -345,6 +345,8 @@ Example Prevents generating summary titles for each chat session when set to `true`. +Note that if the deprecated setting `ui.getChatTitles` is set to `false`, it will override this. + ### `ui` Customizable UI settings to control interface appearance and behavior. diff --git a/gui/src/redux/thunks/session.ts b/gui/src/redux/thunks/session.ts index d9f35cfd6..c311df194 100644 --- a/gui/src/redux/thunks/session.ts +++ b/gui/src/redux/thunks/session.ts @@ -166,7 +166,7 @@ export const saveCurrentSession = createAsyncThunk< let title = state.session.title; if (title === NEW_SESSION_TITLE) { if ( - state.config.config?.ui?.getChatTitles && + !state.config.config?.disableSessionTitles && state.config.defaultModelTitle ) { let assistantResponse = state.session.history @@ -190,7 +190,7 @@ export const saveCurrentSession = createAsyncThunk< } } } - // Fallbacks if above doesn't work out or getChatTitles = false + // Fallbacks if above doesn't work out or session titles disabled if (title === NEW_SESSION_TITLE) { title = getChatTitleFromMessage(state.session.history[0].message); } From c8b47ea7ad26338a2e9d3c52289030ea3c252964 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 22 Jan 2025 17:43:01 -0800 Subject: [PATCH 052/111] codeblock action button makeover --- gui/src/components/gui/CopyIconButton.tsx | 7 +- .../StepContainerPreActionButtons.tsx | 76 ++++++------------- 2 files changed, 27 insertions(+), 56 deletions(-) diff --git a/gui/src/components/gui/CopyIconButton.tsx b/gui/src/components/gui/CopyIconButton.tsx index 560042026..c2fcfd322 100644 --- a/gui/src/components/gui/CopyIconButton.tsx +++ b/gui/src/components/gui/CopyIconButton.tsx @@ -1,7 +1,4 @@ import { CheckIcon, ClipboardIcon } from "@heroicons/react/24/outline"; -import { useContext, useState } from "react"; -import { IdeMessengerContext } from "../../context/IdeMessenger"; -import { isJetBrains } from "../../util"; import HeaderButtonWithToolTip from "./HeaderButtonWithToolTip"; import useCopy from "../../hooks/useCopy"; @@ -10,6 +7,7 @@ interface CopyIconButtonProps { tabIndex?: number; checkIconClassName?: string; clipboardIconClassName?: string; + tooltipPlacement?: "top" | "bottom"; } export function CopyIconButton({ @@ -17,13 +15,14 @@ export function CopyIconButton({ tabIndex, checkIconClassName = "h-4 w-4 text-green-400", clipboardIconClassName = "h-4 w-4 text-gray-400", + tooltipPlacement = "bottom", }: CopyIconButtonProps) { const { copyText, copied } = useCopy(text); return ( <> ` - position: absolute; - ${(props) => (props.isBottomToolbarPosition ? "bottom: 3px;" : "top: -11px;")} - right: 10px; - display: flex; - padding: 1px 2px; - gap: 4px; - border: 0.5px solid #8888; - border-radius: ${defaultBorderRadius}; - background-color: ${vscEditorBackground}; -`; - interface StepContainerPreActionButtonsProps { language: string | null; codeBlockContent: string; @@ -69,9 +38,12 @@ export default function StepContainerPreActionButtons({ const nextCodeBlockIndex = useAppSelector( (state) => state.session.codeBlockApplyStates.curIndex, ); - + const isStreaming = useAppSelector((state) => state.session.isStreaming); const isBottomToolbarPosition = uiConfig?.codeBlockToolbarPosition == "bottom"; + + const toolTipPlacement = isBottomToolbarPosition ? "top" : "bottom"; + const shouldRunTerminalCmd = !isJetBrains() && isTerminalCodeBlock(language, codeBlockContent); const isNextCodeBlock = nextCodeBlockIndex === codeBlockIndex; @@ -107,31 +79,27 @@ export default function StepContainerPreActionButtons({ !isNextCodeBlock, ); - if (!hovering) { - return ( - setHovering(true)} - onMouseLeave={() => setHovering(false)} - > - {children} - - ); - } - return ( - setHovering(true)} onMouseLeave={() => setHovering(false)} + className="bg-vsc-editor-background border-vsc-input-border relative rounded-md border-[1px] border-solid" > - - +
{children}
+ {hovering && !isStreaming && ( +
{shouldRunTerminalCmd && ( @@ -140,6 +108,7 @@ export default function StepContainerPreActionButtons({ text="Apply" style={{ backgroundColor: vscEditorBackground }} onClick={onClickApply} + tooltipPlacement={toolTipPlacement} > @@ -149,13 +118,16 @@ export default function StepContainerPreActionButtons({ onClick={() => ideMessenger.post("insertAtCursor", { text: codeBlockContent }) } + tooltipPlacement={toolTipPlacement} > - - - - {children} - + +
+ )} +
); } From e2a9b9956b6bf786c7fef3d613515e663f2329ab Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 22 Jan 2025 18:12:10 -0800 Subject: [PATCH 053/111] pass isdialog to chat card --- gui/src/pages/gui/Chat.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 51d06ad7a..119ee56c6 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -555,9 +555,9 @@ export function Chat() { {onboardingCard.show && (
{usePlatform ? ( - + ) : ( - + )}
)} From f1ea63f944165e5891faf8b622d60f9983867eac Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 23 Jan 2025 08:40:26 -0800 Subject: [PATCH 054/111] load prompts to slash commands correctly --- core/commands/index.ts | 2 +- core/config/yaml/loadYaml.ts | 6 +++++- core/index.d.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/commands/index.ts b/core/commands/index.ts index 723a4d247..f4a0084da 100644 --- a/core/commands/index.ts +++ b/core/commands/index.ts @@ -9,7 +9,7 @@ export function slashFromCustomCommand( ): SlashCommand { return { name: customCommand.name, - description: customCommand.description, + description: customCommand.description ?? "", run: async function* ({ input, llm, history, ide }) { // Remove slash command prefix from input let userInput = input; diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 09003f6eb..04794c103 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -32,6 +32,7 @@ import { getConfigYamlPath } from "../../util/paths"; import { getSystemPromptDotFile } from "../getSystemPromptDotFile"; import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader"; +import { slashFromCustomCommand } from "../../commands"; import { allTools } from "../../tools"; import { clientRenderHelper } from "./clientRender"; import { llmsFromModelConfig } from "./models"; @@ -95,7 +96,10 @@ async function configYamlToContinueConfig( allowFreeTrial: boolean = true, ): Promise { const continueConfig: ContinueConfig = { - slashCommands: await slashCommandsFromV1PromptFiles(ide), + slashCommands: [ + ...(await slashCommandsFromV1PromptFiles(ide)), + ...(config.prompts?.map(slashFromCustomCommand) ?? []), + ], models: [], tabAutocompleteModels: [], tools: allTools, diff --git a/core/index.d.ts b/core/index.d.ts index a8b423bfd..30c66a2b0 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -826,7 +826,7 @@ export interface SlashCommandDescription { export interface CustomCommand { name: string; prompt: string; - description: string; + description?: string; } export interface Prediction { From acd92dfce0c56a046d67faf9165e576ab9131d78 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 23 Jan 2025 08:40:34 -0800 Subject: [PATCH 055/111] open config.yaml from settings button --- core/config/ConfigHandler.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 24987528a..48ef2e0e4 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -1,3 +1,5 @@ +import * as fs from "node:fs"; + import { ControlPlaneClient, ControlPlaneSessionInfo, @@ -12,7 +14,7 @@ import { } from "../index.js"; import Ollama from "../llm/llms/Ollama.js"; import { GlobalContext } from "../util/GlobalContext.js"; -import { getConfigJsonPath } from "../util/paths.js"; +import { getConfigJsonPath, getConfigYamlPath } from "../util/paths.js"; import { ConfigResult, ConfigYaml } from "@continuedev/config-yaml"; import * as YAML from "yaml"; @@ -97,7 +99,13 @@ export class ConfigHandler { async openConfigProfile(profileId?: string) { let openProfileId = profileId || this.selectedProfileId; if (openProfileId === "local") { - await this.ide.openFile(localPathToUri(getConfigJsonPath())); + const ideInfo = await this.ide.getIdeInfo(); + const configYamlPath = getConfigYamlPath(ideInfo.ideType); + if (fs.existsSync(configYamlPath)) { + await this.ide.openFile(localPathToUri(configYamlPath)); + } else { + await this.ide.openFile(localPathToUri(getConfigJsonPath())); + } } else { await this.ide.openUrl(`${controlPlaneEnv.APP_URL}${openProfileId}`); } From 412a0b78fb4466e5712f2bb49b60be85517b6e34 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 23 Jan 2025 10:47:10 -0800 Subject: [PATCH 056/111] show docs get details button on prod --- gui/src/components/indexing/DocsIndexingStatus.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gui/src/components/indexing/DocsIndexingStatus.tsx b/gui/src/components/indexing/DocsIndexingStatus.tsx index 361005ba5..fe64ae2dc 100644 --- a/gui/src/components/indexing/DocsIndexingStatus.tsx +++ b/gui/src/components/indexing/DocsIndexingStatus.tsx @@ -195,8 +195,7 @@ function DocsIndexingStatus({ docConfig }: IndexingStatusViewerProps) { {status?.description} )} - {process.env.NODE_ENV === "development" && - status?.status === "complete" ? ( + {status?.status === "complete" ? ( { From fbee4a8aece2d4fc956b748761c9893053f6de41 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 23 Jan 2025 11:11:20 -0800 Subject: [PATCH 057/111] import fix --- core/indexing/docs/DocsService.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 74f68af9b..f0d1e2f3c 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -40,7 +40,7 @@ import { SiteIndexingResults, } from "./preIndexed"; import preIndexedDocs from "./preIndexedDocs"; -import { ConfigResult } from "@continuedev/config-types"; +import { ConfigResult } from "@continuedev/config-yaml"; // Purposefully lowercase because lancedb converts export interface LanceDbDocsRow { @@ -713,8 +713,8 @@ export default class DocsService { const db = await this.getOrCreateSqliteDb(); try { - - const { isPreindexed, provider } = await this.getEmbeddingsProvider(startUrl); + const { isPreindexed, provider } = + await this.getEmbeddingsProvider(startUrl); const preIndexedDoc = preIndexedDocs[startUrl]; const isPreIndexedDoc = !!preIndexedDoc; From b7b5701fa7ae74d0cc9de268c0e504d22e59d600 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 23 Jan 2025 16:06:32 -0800 Subject: [PATCH 058/111] fix bug loading config.yaml when context not defined --- core/config/yaml/loadYaml.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 04794c103..cb1c5ea18 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -121,6 +121,7 @@ async function configYamlToContinueConfig( rootUrl: doc.rootUrl, faviconUrl: doc.faviconUrl, })), + contextProviders: [], }; // Models @@ -191,7 +192,7 @@ async function configYamlToContinueConfig( ({ description: { title } }) => title, ); - continueConfig.contextProviders = config.context + continueConfig.contextProviders = (config.context ?.map((context) => { const cls = contextProviderClassFromName(context.uses) as any; if (!cls) { @@ -203,7 +204,7 @@ async function configYamlToContinueConfig( const instance: IContextProvider = new cls(context.with ?? {}); return instance; }) - .filter((p) => !!p) as IContextProvider[]; + .filter((p) => !!p) ?? []) as IContextProvider[]; continueConfig.contextProviders.push(...DEFAULT_CONTEXT_PROVIDERS); // Embeddings Provider From 5e91e466eb2bb61d5b291df9e8f5129dc75fef08 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 23 Jan 2025 18:55:18 -0800 Subject: [PATCH 059/111] display version in assistants select --- core/config/ConfigHandler.ts | 1 + core/config/ProfileLifecycleManager.ts | 8 +++++++- core/config/profile/ControlPlaneProfileLoader.ts | 6 ++++++ core/config/profile/LocalProfileLoader.ts | 6 ++++++ core/config/profile/PlatformProfileLoader.ts | 9 ++++++++- .../modelSelection/platform/AssistantAndModelSelect.tsx | 2 +- 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 48ef2e0e4..97f12d0e6 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -134,6 +134,7 @@ export class ConfigHandler { { ...assistant.configResult, config: renderedConfig }, assistant.ownerSlug, assistant.packageSlug, + assistant.configResult.config?.version ?? "latest", this.controlPlaneClient, this.ide, this.ideSettingsPromise, diff --git a/core/config/ProfileLifecycleManager.ts b/core/config/ProfileLifecycleManager.ts index 88fc387c5..2d3f57da0 100644 --- a/core/config/ProfileLifecycleManager.ts +++ b/core/config/ProfileLifecycleManager.ts @@ -1,4 +1,8 @@ -import { ConfigResult, ConfigValidationError } from "@continuedev/config-yaml"; +import { + ConfigResult, + ConfigValidationError, + FullSlug, +} from "@continuedev/config-yaml"; import { BrowserSerializedContinueConfig, ContinueConfig, @@ -9,6 +13,8 @@ import { finalToBrowserConfig } from "./load.js"; import { IProfileLoader } from "./profile/IProfileLoader.js"; export interface ProfileDescription { + fullSlug: FullSlug; + profileType: string; title: string; id: string; errors: ConfigValidationError[] | undefined; diff --git a/core/config/profile/ControlPlaneProfileLoader.ts b/core/config/profile/ControlPlaneProfileLoader.ts index 38c7fb389..dfb111e1f 100644 --- a/core/config/profile/ControlPlaneProfileLoader.ts +++ b/core/config/profile/ControlPlaneProfileLoader.ts @@ -31,6 +31,12 @@ export default class ControlPlaneProfileLoader implements IProfileLoader { ) { this.description = { id: workspaceId, + profileType: "control-plane", + fullSlug: { + ownerSlug: "", + packageSlug: "", + versionSlug: "", + }, title: workspaceTitle, errors: undefined, }; diff --git a/core/config/profile/LocalProfileLoader.ts b/core/config/profile/LocalProfileLoader.ts index 644e97069..bcc82408d 100644 --- a/core/config/profile/LocalProfileLoader.ts +++ b/core/config/profile/LocalProfileLoader.ts @@ -10,6 +10,12 @@ export default class LocalProfileLoader implements IProfileLoader { static ID = "local"; description: ProfileDescription = { id: LocalProfileLoader.ID, + profileType: LocalProfileLoader.ID, + fullSlug: { + ownerSlug: "", + packageSlug: "", + versionSlug: "", + }, title: "Local Config", errors: undefined, }; diff --git a/core/config/profile/PlatformProfileLoader.ts b/core/config/profile/PlatformProfileLoader.ts index 5319097b3..92e945630 100644 --- a/core/config/profile/PlatformProfileLoader.ts +++ b/core/config/profile/PlatformProfileLoader.ts @@ -29,6 +29,7 @@ export default class PlatformProfileLoader implements IProfileLoader { private configResult: ConfigResult, private readonly ownerSlug: string, private readonly packageSlug: string, + versionSlug: string, private readonly controlPlaneClient: ControlPlaneClient, private readonly ide: IDE, private ideSettingsPromise: Promise, @@ -37,7 +38,13 @@ export default class PlatformProfileLoader implements IProfileLoader { ) { this.description = { id: `${ownerSlug}/${packageSlug}`, - title: `${ownerSlug}/${packageSlug}`, + profileType: "platform", + fullSlug: { + ownerSlug, + packageSlug, + versionSlug, + }, + title: `${ownerSlug}/${packageSlug}@${versionSlug}`, errors: configResult.errors, }; diff --git a/gui/src/components/modelSelection/platform/AssistantAndModelSelect.tsx b/gui/src/components/modelSelection/platform/AssistantAndModelSelect.tsx index 4d0df15e7..c33c3a586 100644 --- a/gui/src/components/modelSelection/platform/AssistantAndModelSelect.tsx +++ b/gui/src/components/modelSelection/platform/AssistantAndModelSelect.tsx @@ -155,7 +155,7 @@ function AssistantAndModelSelect() { aria-hidden="true" /> - {selectedProfile?.title || "Select assistant"} + {selectedProfile?.fullSlug.packageSlug || "Select assistant"} {" / "} {modelSelectTitle(defaultModel) || "Select model"} From 3b335b6f8c7c3cc53cf7219cbfc1cef1c4b7ddb5 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 23 Jan 2025 20:24:53 -0800 Subject: [PATCH 060/111] shared config --- .../StreamTransformPipeline.ts | 1 - core/config/load.ts | 7 +-- core/config/profile/doLoadConfig.ts | 6 +- core/config/sharedConfig.ts | 63 +++++++++++++++++++ core/config/yaml/loadYaml.ts | 28 +++++++-- core/core.ts | 5 ++ core/protocol/core.ts | 2 + core/util/GlobalContext.ts | 51 ++++++++++++--- core/util/paths.ts | 4 ++ 9 files changed, 145 insertions(+), 22 deletions(-) create mode 100644 core/config/sharedConfig.ts diff --git a/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts b/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts index 6bfc6cfe1..1bd90c503 100644 --- a/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts +++ b/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts @@ -76,7 +76,6 @@ export class StreamTransformPipeline { const timeoutValue = await Telemetry.getValueForFeatureFlag( PosthogFeatureFlag.AutocompleteTimeout, ); - // helper.options.showWhateverWeHaveAtXMs ?? DEFAULT_AUTOCOMPLETE_OPTS.showWhateverWeHaveAtXMs lineGenerator = showWhateverWeHaveAtXMs(lineGenerator, timeoutValue!); diff --git a/core/config/load.ts b/core/config/load.ts index c1c3c4261..52cb8cfb9 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -111,11 +111,10 @@ function loadSerializedConfig( overrideConfigJson: SerializedContinueConfig | undefined, ide: IDE, ): ConfigResult { - const configPath = getConfigJsonPath(ideType); let config: SerializedContinueConfig = overrideConfigJson!; if (!config) { try { - config = resolveSerializedConfig(configPath); + config = resolveSerializedConfig(getConfigJsonPath(ideType)); } catch (e) { throw new Error(`Failed to parse config.json: ${e}`); } @@ -766,7 +765,7 @@ async function buildConfigTsandReadConfigJs(ide: IDE, ideType: IdeType) { return readConfigJs(); } -async function loadFullConfigNode( +async function loadContinueConfigFromJson( ide: IDE, workspaceConfigs: ContinueRcJson[], ideSettings: IdeSettings, @@ -876,6 +875,6 @@ async function loadFullConfigNode( export { finalToBrowserConfig, intermediateToFinalConfig, - loadFullConfigNode, + loadContinueConfigFromJson, type BrowserSerializedContinueConfig, }; diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 8e2326e3d..b4f3d5d35 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -20,7 +20,7 @@ import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; import { getConfigYamlPath } from "../../util/paths"; import { Telemetry } from "../../util/posthog"; import { TTS } from "../../util/tts"; -import { loadFullConfigNode } from "../load"; +import { loadContinueConfigFromJson } from "../load"; import { loadContinueConfigFromYaml } from "../yaml/loadYaml"; import { PlatformConfigMetadata } from "./PlatformProfileLoader"; @@ -46,7 +46,7 @@ export default async function doLoadConfig( let errors: ConfigValidationError[] | undefined; let configLoadInterrupted = false; - if (fs.existsSync(configYamlPath) || overrideConfigYaml) { + if (overrideConfigYaml || fs.existsSync(configYamlPath)) { const result = await loadContinueConfigFromYaml( ide, workspaceConfigs.map((c) => JSON.stringify(c)), @@ -63,7 +63,7 @@ export default async function doLoadConfig( errors = result.errors; configLoadInterrupted = result.configLoadInterrupted; } else { - const result = await loadFullConfigNode( + const result = await loadContinueConfigFromJson( ide, workspaceConfigs, ideSettings, diff --git a/core/config/sharedConfig.ts b/core/config/sharedConfig.ts new file mode 100644 index 000000000..23a0e1c2f --- /dev/null +++ b/core/config/sharedConfig.ts @@ -0,0 +1,63 @@ +import z from "zod"; + +const sharedConfigTabAutoCompleteOptionsSchema = z + .object({ + disable: z.boolean(), + useCache: z.boolean(), + disableInFiles: z.array(z.string()), + multilineCompletions: z.enum(["always", "never", "auto"]), + }) + .partial(); + +export const sharedConfigSchema = z + .object({ + allowAnonymousTelemetry: z.boolean(), + disableIndexing: z.boolean(), + disableSessionTitles: z.boolean(), + useChromiumForDocsCrawling: z.boolean(), + readResponseTTS: z.boolean(), + promptPath: z.string(), + tabAutocompleteOptions: sharedConfigTabAutoCompleteOptionsSchema, + + // UI-only, and user-specific: + codeBlockToolbarPosition: z.enum(["top", "bottom"]), + fontSize: z.number(), + codeWrap: z.boolean(), + displayRawMarkdown: z.boolean(), + showChatScrollbar: z.boolean(), + }) + .partial(); + +export type SharedConfigSchema = z.infer; + +// For security in case of damaged config file, try to salvage any security-related values +export function salvageSharedConfig(sharedConfig: object): SharedConfigSchema { + const salvagedConfig: SharedConfigSchema = {}; + if ("allowAnonymousTelemetry" in sharedConfig) { + const val = z.boolean().safeParse(sharedConfig.allowAnonymousTelemetry); + if (val.success) { + salvagedConfig.allowAnonymousTelemetry = val.data; + } + } + if ("disableIndexing" in sharedConfig) { + const val = z.boolean().safeParse(sharedConfig.disableIndexing); + if (val.success) { + salvagedConfig.disableIndexing = val.data; + } + } + if ("disableSessionTitles" in sharedConfig) { + const val = z.boolean().safeParse(sharedConfig.disableSessionTitles); + if (val.success) { + salvagedConfig.disableSessionTitles = val.data; + } + } + if ("tabAutocompleteOptions" in sharedConfig) { + const val = sharedConfigTabAutoCompleteOptionsSchema.safeParse( + sharedConfig.tabAutocompleteOptions, + ); + if (val.success) { + salvagedConfig.tabAutocompleteOptions = val.data; + } + } + return salvagedConfig; +} diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 09003f6eb..b75f83b33 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -35,6 +35,7 @@ import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader"; import { allTools } from "../../tools"; import { clientRenderHelper } from "./clientRender"; import { llmsFromModelConfig } from "./models"; +import { GlobalContext } from "../../util/GlobalContext"; async function loadConfigYaml( workspaceConfigs: string[], @@ -187,8 +188,8 @@ async function configYamlToContinueConfig( ({ description: { title } }) => title, ); - continueConfig.contextProviders = config.context - ?.map((context) => { + continueConfig.contextProviders = (config.context ?? []) + .map((context) => { const cls = contextProviderClassFromName(context.uses) as any; if (!cls) { if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.uses)) { @@ -199,7 +200,7 @@ async function configYamlToContinueConfig( const instance: IContextProvider = new cls(context.with ?? {}); return instance; }) - .filter((p) => !!p) as IContextProvider[]; + .filter((p) => !!p); continueConfig.contextProviders.push(...DEFAULT_CONTEXT_PROVIDERS); // Embeddings Provider @@ -280,6 +281,24 @@ async function configYamlToContinueConfig( clearTimeout(mcpConnectionTimeout); }); + // Apply shared config + const sharedConfig = new GlobalContext().getSharedConfig(); + continueConfig.tabAutocompleteOptions = sharedConfig.tabAutocompleteOptions; + continueConfig.ui = { + codeBlockToolbarPosition: sharedConfig.codeBlockToolbarPosition, + fontSize: sharedConfig.fontSize, + codeWrap: sharedConfig.codeWrap, + displayRawMarkdown: sharedConfig.displayRawMarkdown, + showChatScrollbar: sharedConfig.showChatScrollbar, + }; + continueConfig.allowAnonymousTelemetry = sharedConfig.allowAnonymousTelemetry; + continueConfig.disableIndexing = sharedConfig.disableIndexing; + continueConfig.disableSessionTitles = sharedConfig.disableSessionTitles; + continueConfig.experimental!.useChromiumForDocsCrawling = sharedConfig.useChromiumForDocsCrawling; + continueConfig.experimental!.readResponseTTS = sharedConfig.readResponseTTS; + continueConfig.experimental!.promptPath = sharedConfig.promptPath; + + return continueConfig; } @@ -295,10 +314,9 @@ export async function loadContinueConfigFromYaml( platformConfigMetadata: PlatformConfigMetadata | undefined, controlPlaneClient: ControlPlaneClient, ): Promise> { - const configYamlPath = getConfigYamlPath(ideType); const rawYaml = overrideConfigYaml === undefined - ? fs.readFileSync(configYamlPath, "utf-8") + ? fs.readFileSync(getConfigYamlPath(ideType), "utf-8") : ""; const configYamlResult = await loadConfigYaml( diff --git a/core/core.ts b/core/core.ts index c74f2e539..39917abd4 100644 --- a/core/core.ts +++ b/core/core.ts @@ -294,6 +294,11 @@ export class Core { addContextProvider(msg.data); }); + on("config/updateSharedConfig", async (msg) => { + this.globalContext.updateSharedConfig(msg.data); + await this.configHandler.reloadConfig(); + }); + // Context providers on("context/addDocs", async (msg) => { void this.docsService.indexAndAdd(msg.data); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index b48b11398..98d2a38dd 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -22,6 +22,7 @@ import type { } from "../"; import { AutocompleteInput } from "../autocomplete/util/types"; import { ProfileDescription } from "../config/ConfigHandler"; +import { SharedConfigSchema } from "../config/SharedConfig"; export type OnboardingModes = | "Local" @@ -70,6 +71,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { "config/reload": [undefined, ConfigResult]; "config/listProfiles": [undefined, ProfileDescription[]]; "config/openProfile": [{ profileId: string | undefined }, void]; + "config/updateSharedConfig": [values: SharedConfigSchema, void]; "context/getContextItems": [ { name: string; diff --git a/core/util/GlobalContext.ts b/core/util/GlobalContext.ts index 336dc8293..7202cde04 100644 --- a/core/util/GlobalContext.ts +++ b/core/util/GlobalContext.ts @@ -1,5 +1,11 @@ import fs from "node:fs"; +import { + salvageSharedConfig, + sharedConfigSchema, + SharedConfigSchema, +} from "../config/SharedConfig"; + import { getGlobalContextFilePath } from "./paths"; export type GlobalContextType = { @@ -16,6 +22,7 @@ export type GlobalContextType = { hasAlreadyCreatedAPromptFile: boolean; showConfigUpdateToast: boolean; isSupportedLanceDbCpuTarget: boolean; + sharedConfig: SharedConfigSchema; }; /** @@ -26,9 +33,10 @@ export class GlobalContext { key: T, value: GlobalContextType[T], ) { - if (!fs.existsSync(getGlobalContextFilePath())) { + const filepath = getGlobalContextFilePath(); + if (!fs.existsSync(filepath)) { fs.writeFileSync( - getGlobalContextFilePath(), + filepath, JSON.stringify( { [key]: value, @@ -38,7 +46,7 @@ export class GlobalContext { ), ); } else { - const data = fs.readFileSync(getGlobalContextFilePath(), "utf-8"); + const data = fs.readFileSync(filepath, "utf-8"); let parsed; try { @@ -49,21 +57,19 @@ export class GlobalContext { } parsed[key] = value; - fs.writeFileSync( - getGlobalContextFilePath(), - JSON.stringify(parsed, null, 2), - ); + fs.writeFileSync(filepath, JSON.stringify(parsed, null, 2)); } } get( key: T, ): GlobalContextType[T] | undefined { - if (!fs.existsSync(getGlobalContextFilePath())) { + const filepath = getGlobalContextFilePath(); + if (!fs.existsSync(filepath)) { return undefined; } - const data = fs.readFileSync(getGlobalContextFilePath(), "utf-8"); + const data = fs.readFileSync(filepath, "utf-8"); try { const parsed = JSON.parse(data); return parsed[key]; @@ -72,4 +78,31 @@ export class GlobalContext { return undefined; } } + + getSharedConfig(): SharedConfigSchema { + const sharedConfig = this.get("sharedConfig") ?? {}; + const result = sharedConfigSchema.safeParse(sharedConfig); + if (result.success) { + return result.data; + } else { + // in case of damaged shared config, repair it + // Attempt to salvage any values that are security concerns + console.error("Failed to load shared config, salvaging...", result.error); + const salvagedConfig = salvageSharedConfig(sharedConfig); + this.update("sharedConfig", salvagedConfig); + return salvagedConfig; + } + } + + updateSharedConfig( + newValues: Partial, + ): SharedConfigSchema { + const currentSharedConfig = this.getSharedConfig(); + const updatedSharedConfig = { + ...currentSharedConfig, + ...newValues, + }; + this.update("sharedConfig", updatedSharedConfig); + return updatedSharedConfig; + } } diff --git a/core/util/paths.ts b/core/util/paths.ts index 562d2e819..68b7e0471 100644 --- a/core/util/paths.ts +++ b/core/util/paths.ts @@ -74,6 +74,10 @@ export function getGlobalContextFilePath(): string { return path.join(getIndexFolderPath(), "globalContext.json"); } +export function getSharedConfigFilePath(): string { + return path.join(getContinueGlobalPath(), "sharedConfig.json"); +} + export function getSessionFilePath(sessionId: string): string { return path.join(getSessionsFolderPath(), `${sessionId}.json`); } From 315c9acbe5818d7c14257f4123c79bd6d75b2af5 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 23 Jan 2025 20:39:20 -0800 Subject: [PATCH 061/111] imports --- core/config/yaml/loadYaml.ts | 5 +++-- core/util/GlobalContext.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index b75f83b33..b2fe17945 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -282,6 +282,7 @@ async function configYamlToContinueConfig( }); // Apply shared config + // TODO: override several of these values with user/org shared config const sharedConfig = new GlobalContext().getSharedConfig(); continueConfig.tabAutocompleteOptions = sharedConfig.tabAutocompleteOptions; continueConfig.ui = { @@ -294,11 +295,11 @@ async function configYamlToContinueConfig( continueConfig.allowAnonymousTelemetry = sharedConfig.allowAnonymousTelemetry; continueConfig.disableIndexing = sharedConfig.disableIndexing; continueConfig.disableSessionTitles = sharedConfig.disableSessionTitles; - continueConfig.experimental!.useChromiumForDocsCrawling = sharedConfig.useChromiumForDocsCrawling; + continueConfig.experimental!.useChromiumForDocsCrawling = + sharedConfig.useChromiumForDocsCrawling; continueConfig.experimental!.readResponseTTS = sharedConfig.readResponseTTS; continueConfig.experimental!.promptPath = sharedConfig.promptPath; - return continueConfig; } diff --git a/core/util/GlobalContext.ts b/core/util/GlobalContext.ts index 7202cde04..90b403d41 100644 --- a/core/util/GlobalContext.ts +++ b/core/util/GlobalContext.ts @@ -4,7 +4,7 @@ import { salvageSharedConfig, sharedConfigSchema, SharedConfigSchema, -} from "../config/SharedConfig"; +} from "../config/sharedConfig"; import { getGlobalContextFilePath } from "./paths"; From 593fc2e669c15ce305320c85723c6c1824fb4d5c Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 23 Jan 2025 21:25:37 -0800 Subject: [PATCH 062/111] config page --- .../actions/ContinuePluginActions.kt | 5 ++- .../src/main/resources/META-INF/plugin.xml | 10 ++--- extensions/vscode/package.json | 4 +- gui/src/App.tsx | 5 +++ gui/src/pages/config/index.tsx | 40 +++++++++++++++++++ gui/src/util/navigation.ts | 1 + 6 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 gui/src/pages/config/index.tsx diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt index 852fb4f02..b93d294e1 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt @@ -120,8 +120,9 @@ class ViewHistoryAction : AnAction() { class OpenConfigAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { val continuePluginService = getContinuePluginService(e.project) ?: return - val params = mapOf("profileId" to null) - continuePluginService.coreMessenger?.request("config/openProfile", params, null) { _ -> } + continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus() + val params = mapOf("path" to "/config", "toggle" to true) + continuePluginService.sendToWebview("navigateTo", params) } } diff --git a/extensions/intellij/src/main/resources/META-INF/plugin.xml b/extensions/intellij/src/main/resources/META-INF/plugin.xml index a5e16ecc5..5a43ff24f 100644 --- a/extensions/intellij/src/main/resources/META-INF/plugin.xml +++ b/extensions/intellij/src/main/resources/META-INF/plugin.xml @@ -132,12 +132,12 @@ - - + text="Continue Config" + description="Continue Config"> + - + diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 23c151699..a22b3408f 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -213,7 +213,7 @@ "group": "Continue" }, { - "command": "continue.openConfig", + "command": "continue.openConfigPage", "category": "Continue", "title": "Open Continue Config", "icon": "$(gear)", @@ -522,7 +522,7 @@ "when": "view == continue.continueGUIView" }, { - "command": "continue.openConfig", + "command": "continue.openConfigPage", "group": "navigation@4", "when": "view == continue.continueGUIView" }, diff --git a/gui/src/App.tsx b/gui/src/App.tsx index 18df91b86..73d667292 100644 --- a/gui/src/App.tsx +++ b/gui/src/App.tsx @@ -13,6 +13,7 @@ import MorePage from "./pages/More"; import Stats from "./pages/stats"; import { ROUTES } from "./util/navigation"; import { SubmenuContextProvidersProvider } from "./context/SubmenuContextProviders"; +import ConfigPage from "./pages/config"; const router = createMemoryRouter([ { @@ -52,6 +53,10 @@ const router = createMemoryRouter([ path: ROUTES.CONFIG_ERROR, element: , }, + { + path: ROUTES.CONFIG, + element: , + }, { path: "/migration", element: , diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx new file mode 100644 index 000000000..a7d67b770 --- /dev/null +++ b/gui/src/pages/config/index.tsx @@ -0,0 +1,40 @@ +import { useContext } from "react"; +import { useNavigate } from "react-router-dom"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { useNavigationListener } from "../../hooks/useNavigationListener"; +import PageHeader from "../../components/PageHeader"; +import { useAppDispatch, useAppSelector } from "../../redux/hooks"; +import { SharedConfigSchema } from "core/config/sharedConfig"; +import { Switch } from "@headlessui/react"; +import { updateConfig } from "../../redux/slices/configSlice"; + +function ConfigPage() { + useNavigationListener(); + const dispatch = useAppDispatch(); + const navigate = useNavigate(); + const ideMessenger = useContext(IdeMessengerContext); + + const config = useAppSelector((state) => state.config.config); + + function handleUpdateSharedConfig(sharedConfig: Partial) { + ideMessenger.post("config/updateSharedConfig", sharedConfig); + + // TODO: Optimistic update in redux + // dispatch(updateConfig({ + // ...config, + // ...(sharedConfig.) + // })) + } + + return ( +
+ navigate("/")} title="Chat" /> + +
+ Hello +
+
+ ); +} + +export default ConfigPage; diff --git a/gui/src/util/navigation.ts b/gui/src/util/navigation.ts index 2416226d8..eed39333d 100644 --- a/gui/src/util/navigation.ts +++ b/gui/src/util/navigation.ts @@ -2,6 +2,7 @@ export const ROUTES = { HOME: "/", CONFIG_ERROR: "/config-error", + CONFIG: "/config", MORE: "/more", // EXAMPLE_ROUTE_WITH_PARAMS: (params: ParamsType) => `/route/${params}`, }; From 468acacd0a68c8b946b0291e3a7cda1ea59ba9cd Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 24 Jan 2025 02:00:44 -0800 Subject: [PATCH 063/111] vscode setting for platform --- core/config/ConfigHandler.ts | 65 +++++++++++++++---- core/config/ProfileLifecycleManager.ts | 13 +++- core/config/load.ts | 11 ++-- core/config/profile/LocalProfileLoader.ts | 2 +- core/config/profile/PlatformProfileLoader.ts | 32 +-------- core/config/profile/doLoadConfig.ts | 6 +- .../providers/ContinueProxyContextProvider.ts | 11 ++-- .../providers/_context-providers.test.ts | 2 +- core/control-plane/auth/index.ts | 13 ++-- core/control-plane/client.ts | 34 ++++++++-- core/control-plane/env.ts | 45 ++++++++++--- core/control-plane/flags.ts | 13 ---- core/core.ts | 10 +-- core/index.d.ts | 1 + core/indexing/docs/DocsService.skip.ts | 22 ++++--- core/test/fixtures.ts | 1 + core/util/filesystem.ts | 1 + core/util/paths.ts | 12 ---- extensions/vscode/package.json | 14 +++- extensions/vscode/src/VsCodeIde.ts | 3 + .../vscode/src/extension/VsCodeExtension.ts | 14 +++- .../vscode/src/stubs/WorkOsAuthProvider.ts | 11 +++- gui/src/context/Auth.tsx | 15 +++-- gui/src/redux/slices/sessionSlice.ts | 6 ++ 24 files changed, 224 insertions(+), 133 deletions(-) delete mode 100644 core/control-plane/flags.ts diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 97f12d0e6..3c217bbb5 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -16,10 +16,9 @@ import Ollama from "../llm/llms/Ollama.js"; import { GlobalContext } from "../util/GlobalContext.js"; import { getConfigJsonPath, getConfigYamlPath } from "../util/paths.js"; -import { ConfigResult, ConfigYaml } from "@continuedev/config-yaml"; +import { ConfigResult, ConfigYaml, FullSlug } from "@continuedev/config-yaml"; import * as YAML from "yaml"; -import { controlPlaneEnv } from "../control-plane/env.js"; -import { usePlatform } from "../control-plane/flags.js"; +import { getControlPlaneEnv, useHub } from "../control-plane/env.js"; import { localPathToUri } from "../util/pathToUri.js"; import { LOCAL_ONBOARDING_CHAT_MODEL, @@ -27,7 +26,7 @@ import { } from "./onboarding.js"; import ControlPlaneProfileLoader from "./profile/ControlPlaneProfileLoader.js"; import LocalProfileLoader from "./profile/LocalProfileLoader.js"; -import PlatformProfileLoader from "./profile/PlatformProfileLoader.js"; +import PlatformProfileLoader from "./profile/PlatformProfileLoader.1.js"; import { ProfileDescription, ProfileLifecycleManager, @@ -63,7 +62,7 @@ export class ConfigHandler { controlPlaneClient, writeLog, ); - this.profiles = [new ProfileLifecycleManager(localProfileLoader)]; + this.profiles = [new ProfileLifecycleManager(localProfileLoader, this.ide)]; this.selectedProfileId = localProfileLoader.description.id; // Always load local profile immediately in case control plane doesn't load @@ -107,7 +106,8 @@ export class ConfigHandler { await this.ide.openFile(localPathToUri(getConfigJsonPath())); } } else { - await this.ide.openUrl(`${controlPlaneEnv.APP_URL}${openProfileId}`); + const env = await getControlPlaneEnv(this.ide.getIdeSettings()); + await this.ide.openUrl(`${env.APP_URL}${openProfileId}`); } } @@ -145,7 +145,7 @@ export class ConfigHandler { ...this.profiles.filter( (profile) => profile.profileDescription.id === "local", ), - new ProfileLifecycleManager(profileLoader), + new ProfileLifecycleManager(profileLoader, this.ide), ]; }), ); @@ -177,15 +177,49 @@ export class ConfigHandler { } private platformProfilesRefreshInterval: NodeJS.Timeout | undefined; + // We use this to keep track of whether we should reload the assistants + private lastFullSlugsList: FullSlug[] = []; + + private fullSlugsListsDiffer(a: FullSlug[], b: FullSlug[]): boolean { + if (a.length !== b.length) { + return true; + } + for (let i = 0; i < a.length; i++) { + if (a[i].ownerSlug !== b[i].ownerSlug) { + return true; + } + if (a[i].packageSlug !== b[i].packageSlug) { + return true; + } + if (a[i].versionSlug !== b[i].versionSlug) { + return true; + } + } + return false; + } private async fetchControlPlaneProfiles() { - if (usePlatform()) { + if (await useHub(this.ideSettingsPromise)) { clearInterval(this.platformProfilesRefreshInterval); await this.loadPlatformProfiles(); - this.platformProfilesRefreshInterval = setInterval( - this.loadPlatformProfiles.bind(this), - PlatformProfileLoader.RELOAD_INTERVAL, - ); + + // Every 5 seconds we ask the platform whether there are any assistant updates in the last 5 seconds + // If so, we do the full (more expensive) reload + this.platformProfilesRefreshInterval = setInterval(async () => { + const newFullSlugsList = + await this.controlPlaneClient.listAssistantFullSlugs(); + + if (newFullSlugsList) { + const shouldReload = this.fullSlugsListsDiffer( + newFullSlugsList, + this.lastFullSlugsList, + ); + if (shouldReload) { + await this.loadPlatformProfiles(); + } + this.lastFullSlugsList = newFullSlugsList; + } + }, PlatformProfileLoader.RELOAD_INTERVAL); } else { this.controlPlaneClient .listWorkspaces() @@ -203,7 +237,9 @@ export class ConfigHandler { this.writeLog, this.reloadConfig.bind(this), ); - this.profiles.push(new ProfileLifecycleManager(profileLoader)); + this.profiles.push( + new ProfileLifecycleManager(profileLoader, this.ide), + ); }); this.notifyProfileListeners( @@ -258,11 +294,12 @@ export class ConfigHandler { void this.reloadConfig(); } - updateControlPlaneSessionInfo( + async updateControlPlaneSessionInfo( sessionInfo: ControlPlaneSessionInfo | undefined, ) { this.controlPlaneClient = new ControlPlaneClient( Promise.resolve(sessionInfo), + this.ideSettingsPromise, ); this.fetchControlPlaneProfiles().catch((e) => { console.error("Failed to fetch control plane profiles: ", e); diff --git a/core/config/ProfileLifecycleManager.ts b/core/config/ProfileLifecycleManager.ts index 2d3f57da0..fa76c6b55 100644 --- a/core/config/ProfileLifecycleManager.ts +++ b/core/config/ProfileLifecycleManager.ts @@ -7,6 +7,7 @@ import { BrowserSerializedContinueConfig, ContinueConfig, IContextProvider, + IDE, } from "../index.js"; import { finalToBrowserConfig } from "./load.js"; @@ -14,7 +15,7 @@ import { IProfileLoader } from "./profile/IProfileLoader.js"; export interface ProfileDescription { fullSlug: FullSlug; - profileType: string; + profileType: "control-plane" | "local" | "platform"; title: string; id: string; errors: ConfigValidationError[] | undefined; @@ -25,7 +26,10 @@ export class ProfileLifecycleManager { private savedBrowserConfigResult?: ConfigResult; private pendingConfigPromise?: Promise>; - constructor(private readonly profileLoader: IProfileLoader) {} + constructor( + private readonly profileLoader: IProfileLoader, + private readonly ide: IDE, + ) {} get profileDescription(): ProfileDescription { return this.profileLoader.description; @@ -93,7 +97,10 @@ export class ProfileLifecycleManager { config: undefined, }; } - const serializedConfig = finalToBrowserConfig(result.config); + const serializedConfig = await finalToBrowserConfig( + result.config, + this.ide, + ); return { ...result, config: serializedConfig, diff --git a/core/config/load.ts b/core/config/load.ts index c1c3c4261..af71ca172 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -63,7 +63,6 @@ import { } from "../util/paths"; import { ConfigResult, ConfigValidationError } from "@continuedev/config-yaml"; -import { usePlatform } from "../control-plane/flags"; import { defaultContextProvidersJetBrains, defaultContextProvidersVsCode, @@ -72,8 +71,9 @@ import { } from "./default"; import { getSystemPromptDotFile } from "./getSystemPromptDotFile"; // import { isSupportedLanceDbCpuTarget } from "./util"; -import { validateConfig } from "./validation.js"; +import { useHub } from "../control-plane/env"; import { localPathToUri } from "../util/pathToUri"; +import { validateConfig } from "./validation.js"; function resolveSerializedConfig(filepath: string): SerializedContinueConfig { let content = fs.readFileSync(filepath, "utf8"); @@ -547,9 +547,10 @@ async function intermediateToFinalConfig( return { config: continueConfig, errors }; } -function finalToBrowserConfig( +async function finalToBrowserConfig( final: ContinueConfig, -): BrowserSerializedContinueConfig { + ide: IDE, +): Promise { return { allowAnonymousTelemetry: final.allowAnonymousTelemetry, models: final.models.map((m) => ({ @@ -582,7 +583,7 @@ function finalToBrowserConfig( experimental: final.experimental, docs: final.docs, tools: final.tools, - usePlatform: usePlatform(), + usePlatform: await useHub(ide.getIdeSettings()), }; } diff --git a/core/config/profile/LocalProfileLoader.ts b/core/config/profile/LocalProfileLoader.ts index bcc82408d..cb8694bbc 100644 --- a/core/config/profile/LocalProfileLoader.ts +++ b/core/config/profile/LocalProfileLoader.ts @@ -10,7 +10,7 @@ export default class LocalProfileLoader implements IProfileLoader { static ID = "local"; description: ProfileDescription = { id: LocalProfileLoader.ID, - profileType: LocalProfileLoader.ID, + profileType: "local", fullSlug: { ownerSlug: "", packageSlug: "", diff --git a/core/config/profile/PlatformProfileLoader.ts b/core/config/profile/PlatformProfileLoader.ts index 92e945630..f703b2a2c 100644 --- a/core/config/profile/PlatformProfileLoader.ts +++ b/core/config/profile/PlatformProfileLoader.ts @@ -1,12 +1,10 @@ import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js"; -import * as YAML from "yaml"; import { ControlPlaneClient } from "../../control-plane/client.js"; import { ContinueConfig, IDE, IdeSettings } from "../../index.js"; import { ConfigResult } from "@continuedev/config-yaml"; import { ProfileDescription } from "../ProfileLifecycleManager.js"; -import { clientRenderHelper } from "../yaml/clientRender.js"; import doLoadConfig from "./doLoadConfig.js"; import { IProfileLoader } from "./IProfileLoader.js"; @@ -21,7 +19,7 @@ export interface PlatformConfigMetadata { } export default class PlatformProfileLoader implements IProfileLoader { - static RELOAD_INTERVAL = 1000 * 60 * 15; // every 15 minutes + static RELOAD_INTERVAL = 1000 * 5; // 5 seconds description: ProfileDescription; @@ -47,34 +45,6 @@ export default class PlatformProfileLoader implements IProfileLoader { title: `${ownerSlug}/${packageSlug}@${versionSlug}`, errors: configResult.errors, }; - - setInterval(async () => { - const assistants = await this.controlPlaneClient.listAssistants(); - const newConfigResult = assistants.find( - (assistant) => - assistant.packageSlug === this.packageSlug && - assistant.ownerSlug === this.ownerSlug, - )?.configResult; - if (!newConfigResult) { - return; - } - - let renderedConfig: ConfigYaml | undefined = undefined; - if (newConfigResult.config) { - renderedConfig = await clientRenderHelper( - YAML.stringify(newConfigResult.config), - this.ide, - this.controlPlaneClient, - ); - } - - this.configResult = { - config: renderedConfig, - errors: newConfigResult.errors, - configLoadInterrupted: false, - }; - this.onReload(); - }, PlatformProfileLoader.RELOAD_INTERVAL); } async doLoadConfig(): Promise> { diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 8e2326e3d..3a64ef71c 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -14,7 +14,7 @@ import { } from "../../"; import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js"; import { ControlPlaneClient } from "../../control-plane/client.js"; -import { controlPlaneEnv } from "../../control-plane/env.js"; +import { getControlPlaneEnv } from "../../control-plane/env.js"; import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js"; import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; import { getConfigYamlPath } from "../../util/paths"; @@ -99,9 +99,11 @@ export default async function doLoadConfig( const controlPlane = (newConfig as any).controlPlane; const useOnPremProxy = controlPlane?.useContinueForTeamsProxy === false && controlPlane?.proxyUrl; + + const env = await getControlPlaneEnv(ideSettingsPromise); let controlPlaneProxyUrl: string = useOnPremProxy ? controlPlane?.proxyUrl - : controlPlaneEnv.DEFAULT_CONTROL_PLANE_PROXY_URL; + : env.DEFAULT_CONTROL_PLANE_PROXY_URL; if (!controlPlaneProxyUrl.endsWith("/")) { controlPlaneProxyUrl += "/"; diff --git a/core/context/providers/ContinueProxyContextProvider.ts b/core/context/providers/ContinueProxyContextProvider.ts index 2dcb91cc8..278a12678 100644 --- a/core/context/providers/ContinueProxyContextProvider.ts +++ b/core/context/providers/ContinueProxyContextProvider.ts @@ -1,4 +1,4 @@ -import { controlPlaneEnv } from "../../control-plane/env.js"; +import { getControlPlaneEnv } from "../../control-plane/env.js"; import { ContextItem, ContextProviderDescription, @@ -35,11 +35,9 @@ class ContinueProxyContextProvider extends BaseContextProvider { async loadSubmenuItems( args: LoadSubmenuItemsArgs, ): Promise { + const env = await getControlPlaneEnv(args.ide.getIdeSettings()); const response = await args.fetch( - new URL( - `/proxy/context/${this.options.id}/list`, - controlPlaneEnv.CONTROL_PLANE_URL, - ), + new URL(`/proxy/context/${this.options.id}/list`, env.CONTROL_PLANE_URL), { method: "GET", headers: { @@ -56,10 +54,11 @@ class ContinueProxyContextProvider extends BaseContextProvider { query: string, extras: ContextProviderExtras, ): Promise { + const env = await getControlPlaneEnv(extras.ide.getIdeSettings()); const response = await extras.fetch( new URL( `/proxy/context/${this.options.id}/retrieve`, - controlPlaneEnv.CONTROL_PLANE_URL, + env.CONTROL_PLANE_URL, ), { method: "POST", diff --git a/core/context/providers/_context-providers.test.ts b/core/context/providers/_context-providers.test.ts index 24cac2c44..22f1dffbc 100644 --- a/core/context/providers/_context-providers.test.ts +++ b/core/context/providers/_context-providers.test.ts @@ -31,7 +31,7 @@ async function getContextProviderExtras( ide, ideSettingsPromise, async (text) => {}, - new ControlPlaneClient(Promise.resolve(undefined)), + new ControlPlaneClient(Promise.resolve(undefined), ideSettingsPromise), ); const { config } = await configHandler.loadConfig(); if (!config) { diff --git a/core/control-plane/auth/index.ts b/core/control-plane/auth/index.ts index f7d423f83..8965f4fdb 100644 --- a/core/control-plane/auth/index.ts +++ b/core/control-plane/auth/index.ts @@ -1,13 +1,16 @@ import { v4 as uuidv4 } from "uuid"; +import { IdeSettings } from "../.."; +import { getControlPlaneEnv } from "../env"; -import { controlPlaneEnv } from "../env"; - -export async function getAuthUrlForTokenPage(): Promise { +export async function getAuthUrlForTokenPage( + ideSettingsPromise: Promise, +): Promise { + const env = await getControlPlaneEnv(ideSettingsPromise); const url = new URL("https://api.workos.com/user_management/authorize"); const params = { response_type: "code", - client_id: controlPlaneEnv.WORKOS_CLIENT_ID, - redirect_uri: `${controlPlaneEnv.APP_URL}tokens/callback`, + client_id: env.WORKOS_CLIENT_ID, + redirect_uri: `${env.APP_URL}tokens/callback`, // redirect_uri: "http://localhost:3000/tokens/callback", state: uuidv4(), provider: "authkit", diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index bb7661ee8..044006882 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -2,10 +2,15 @@ import { ConfigJson } from "@continuedev/config-types"; import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js"; import fetch, { RequestInit, Response } from "node-fetch"; -import { ModelDescription } from "../index.js"; +import { IdeSettings, ModelDescription } from "../index.js"; -import { ConfigResult, FQSN, SecretResult } from "@continuedev/config-yaml"; -import { controlPlaneEnv } from "./env.js"; +import { + ConfigResult, + FQSN, + FullSlug, + SecretResult, +} from "@continuedev/config-yaml"; +import { getControlPlaneEnv } from "./env.js"; export interface ControlPlaneSessionInfo { accessToken: string; @@ -27,7 +32,6 @@ export const TRIAL_PROXY_URL = "https://proxy-server-blue-l6vsfbzhba-uw.a.run.app"; export class ControlPlaneClient { - private static URL = controlPlaneEnv.CONTROL_PLANE_URL; private static ACCESS_TOKEN_VALID_FOR_MS = 1000 * 60 * 5; // 5 minutes private lastAccessTokenRefresh = 0; @@ -36,6 +40,7 @@ export class ControlPlaneClient { private readonly sessionInfoPromise: Promise< ControlPlaneSessionInfo | undefined >, + private readonly ideSettingsPromise: Promise, ) {} async resolveFQSNs(fqsns: FQSN[]): Promise<(SecretResult | undefined)[]> { @@ -66,7 +71,9 @@ export class ControlPlaneClient { if (!accessToken) { throw new Error("No access token"); } - const url = new URL(path, ControlPlaneClient.URL).toString(); + + const env = await getControlPlaneEnv(this.ideSettingsPromise); + const url = new URL(path, env.CONTROL_PLANE_URL).toString(); const resp = await fetch(url, { ...init, headers: { @@ -123,6 +130,23 @@ export class ControlPlaneClient { } } + public async listAssistantFullSlugs(): Promise { + const userId = await this.userId; + if (!userId) { + return null; + } + + try { + const resp = await this.request("ide/list-assistant-full-slugs", { + method: "GET", + }); + const { fullSlugs } = (await resp.json()) as any; + return fullSlugs; + } catch (e) { + return null; + } + } + async getSettingsForWorkspace(workspaceId: string): Promise { const userId = await this.userId; if (!userId) { diff --git a/core/control-plane/env.ts b/core/control-plane/env.ts index 16adf0990..fd37c31a8 100644 --- a/core/control-plane/env.ts +++ b/core/control-plane/env.ts @@ -1,7 +1,6 @@ -import { readUsePlatform } from "../util/paths"; -import { usePlatform } from "./flags"; +import { IdeSettings } from ".."; -interface ControlPlaneEnv { +export interface ControlPlaneEnv { DEFAULT_CONTROL_PLANE_PROXY_URL: string; CONTROL_PLANE_URL: string; AUTH_TYPE: string; @@ -27,6 +26,14 @@ const PRODUCTION_ENV: ControlPlaneEnv = { APP_URL: "https://app.continue.dev/", }; +const PRODUCTION_HUB_ENV: ControlPlaneEnv = { + DEFAULT_CONTROL_PLANE_PROXY_URL: "https://api.continue.dev/", + CONTROL_PLANE_URL: "https://api.continue.dev/", + AUTH_TYPE: WORKOS_ENV_ID_PRODUCTION, + WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_PRODUCTION, + APP_URL: "https://hub.continue.dev/", +}; + const STAGING_ENV: ControlPlaneEnv = { DEFAULT_CONTROL_PLANE_PROXY_URL: "https://control-plane-api-service-537175798139.us-central1.run.app/", @@ -53,17 +60,37 @@ const LOCAL_ENV: ControlPlaneEnv = { APP_URL: "http://localhost:3000/", }; -function getControlPlaneEnv(): ControlPlaneEnv { - const usePlatformFileEnv = readUsePlatform(); - const env = usePlatformFileEnv || process.env.CONTROL_PLANE_ENV; +export async function getControlPlaneEnv( + ideSettingsPromise: Promise, +): Promise { + const ideSettings = await ideSettingsPromise; + return getControlPlaneEnvSync(ideSettings.continueTestEnvironment); +} + +export function getControlPlaneEnvSync( + ideTestEnvironment: IdeSettings["continueTestEnvironment"], +): ControlPlaneEnv { + const env = + ideTestEnvironment === "production" + ? "hub" + : ideTestEnvironment === "test" + ? "test" + : process.env.CONTROL_PLANE_ENV; return env === "local" ? LOCAL_ENV : env === "staging" ? STAGING_ENV - : env === "test" || usePlatform() + : env === "test" ? TEST_ENV - : PRODUCTION_ENV; + : env === "hub" + ? PRODUCTION_HUB_ENV + : PRODUCTION_ENV; } -export const controlPlaneEnv = getControlPlaneEnv(); +export async function useHub( + ideSettingsPromise: Promise, +): Promise { + const ideSettings = await ideSettingsPromise; + return ideSettings.continueTestEnvironment !== "none"; +} diff --git a/core/control-plane/flags.ts b/core/control-plane/flags.ts deleted file mode 100644 index 7b8ff6799..000000000 --- a/core/control-plane/flags.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { readUsePlatform, usePlatformPathExists } from "../util/paths"; - -export function usePlatform(): boolean { - return usePlatformPathExists(); -} - -export function getEnvFromUsePlatformFile(): string | undefined { - const contents = readUsePlatform(); - if (contents && contents.trim().length > 0) { - return contents.trim(); - } - return undefined; -} diff --git a/core/core.ts b/core/core.ts index c74f2e539..39a52a6df 100644 --- a/core/core.ts +++ b/core/core.ts @@ -52,7 +52,6 @@ import { type IndexingProgressUpdate, } from "."; -import { usePlatform } from "./control-plane/flags"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import type { IMessenger, Message } from "./protocol/messenger"; @@ -111,10 +110,13 @@ export class Core { const ideSettingsPromise = messenger.request("getIdeSettings", undefined); const sessionInfoPromise = messenger.request("getControlPlaneSessionInfo", { silent: true, - useOnboarding: usePlatform(), + useOnboarding: false, }); - this.controlPlaneClient = new ControlPlaneClient(sessionInfoPromise); + this.controlPlaneClient = new ControlPlaneClient( + sessionInfoPromise, + ideSettingsPromise, + ); this.configHandler = new ConfigHandler( this.ide, @@ -865,7 +867,7 @@ export class Core { this.configHandler.updateControlPlaneSessionInfo(msg.data.sessionInfo); }); on("auth/getAuthUrl", async (msg) => { - const url = await getAuthUrlForTokenPage(); + const url = await getAuthUrlForTokenPage(ideSettingsPromise); return { url }; }); diff --git a/core/index.d.ts b/core/index.d.ts index 30c66a2b0..998ccb312 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -583,6 +583,7 @@ export interface IdeSettings { remoteConfigSyncPeriod: number; userToken: string; enableControlServerBeta: boolean; + continueTestEnvironment: "none" | "production" | "test"; pauseCodebaseIndexOnStart: boolean; enableDebugLogs: boolean; } diff --git a/core/indexing/docs/DocsService.skip.ts b/core/indexing/docs/DocsService.skip.ts index 6f9853afe..0064f064c 100644 --- a/core/indexing/docs/DocsService.skip.ts +++ b/core/indexing/docs/DocsService.skip.ts @@ -4,7 +4,6 @@ import { ConfigHandler } from "../../config/ConfigHandler.js"; import { ControlPlaneClient } from "../../control-plane/client.js"; import { SiteIndexingConfig } from "../../index.js"; -import FreeTrial from "../../llm/llms/FreeTrial.js"; import FileSystemIde from "../../util/filesystem.js"; import { editConfigJson } from "../../util/paths.js"; @@ -37,17 +36,19 @@ describe.skip("DocsService Integration Tests", () => { beforeEach(async () => { ide = new FileSystemIde(process.cwd()); + const ideSettingsPromise = Promise.resolve({ + remoteConfigSyncPeriod: 60, + userToken: "", + enableControlServerBeta: false, + continueTestEnvironment: "none" as const, + pauseCodebaseIndexOnStart: false, + ideSettings: {} as any, + enableDebugLogs: false, + remoteConfigServerUrl: "", + }); configHandler = new ConfigHandler( ide, - Promise.resolve({ - remoteConfigSyncPeriod: 60, - userToken: "", - enableControlServerBeta: false, - pauseCodebaseIndexOnStart: false, - ideSettings: {} as any, - enableDebugLogs: false, - remoteConfigServerUrl: "", - }), + ideSettingsPromise, async () => {}, new ControlPlaneClient( Promise.resolve({ @@ -57,6 +58,7 @@ describe.skip("DocsService Integration Tests", () => { label: "", }, }), + ideSettingsPromise, ), ); diff --git a/core/test/fixtures.ts b/core/test/fixtures.ts index 78ee60150..4f8601303 100644 --- a/core/test/fixtures.ts +++ b/core/test/fixtures.ts @@ -11,6 +11,7 @@ export const ideSettingsPromise = testIde.getIdeSettings(); export const testControlPlaneClient = new ControlPlaneClient( Promise.resolve(undefined), + ideSettingsPromise, ); export const testConfigHandler = new ConfigHandler( diff --git a/core/util/filesystem.ts b/core/util/filesystem.ts index ccb550ec9..be33346e7 100644 --- a/core/util/filesystem.ts +++ b/core/util/filesystem.ts @@ -53,6 +53,7 @@ class FileSystemIde implements IDE { remoteConfigSyncPeriod: 60, userToken: "", enableControlServerBeta: false, + continueTestEnvironment: "none", pauseCodebaseIndexOnStart: false, enableDebugLogs: false, }; diff --git a/core/util/paths.ts b/core/util/paths.ts index 562d2e819..836bc84b9 100644 --- a/core/util/paths.ts +++ b/core/util/paths.ts @@ -301,18 +301,6 @@ export function getPathToRemoteConfig(remoteConfigServerUrl: string): string { return dir; } -export function usePlatformPathExists(): boolean { - const sPath = path.join(getContinueGlobalPath(), ".use_platform"); - return fs.existsSync(sPath); -} - -export function readUsePlatform(): string | undefined { - const sPath = path.join(getContinueGlobalPath(), ".use_platform"); - if (fs.existsSync(sPath)) { - return fs.readFileSync(sPath, "utf8"); - } -} - export function getConfigJsonPathForRemote( remoteConfigServerUrl: string, ): string { diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 23c151699..a6eba5ce7 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -96,6 +96,16 @@ "default": false, "markdownDescription": "Enable Continue for teams beta features. To sign in, click the person icon in the bottom right of the sidebar." }, + "continue.continueTestEnvironment": { + "type": "string", + "enum": [ + "none", + "production", + "test" + ], + "default": "none", + "description": "Continue test environment" + }, "continue.showInlineTip": { "type": "boolean", "default": true, @@ -529,12 +539,12 @@ { "command": "continue.signInToControlPlane", "group": "navigation@5", - "when": "(view == continue.continueGUIView) && config.continue.enableContinueForTeams && !continue.isSignedInToControlPlane" + "when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.continueTestEnvironment !== 'none') && !continue.isSignedInToControlPlane" }, { "command": "continue.openAccountDialog", "group": "navigation@5", - "when": "(view == continue.continueGUIView) && config.continue.enableContinueForTeams && continue.isSignedInToControlPlane" + "when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.continueTestEnvironment !== 'none') && continue.isSignedInToControlPlane" }, { "command": "continue.openMorePage", diff --git a/extensions/vscode/src/VsCodeIde.ts b/extensions/vscode/src/VsCodeIde.ts index 51008db8a..fbd2077a1 100644 --- a/extensions/vscode/src/VsCodeIde.ts +++ b/extensions/vscode/src/VsCodeIde.ts @@ -636,6 +636,9 @@ class VsCodeIde implements IDE { "enableContinueForTeams", false, ), + continueTestEnvironment: settings.get< + IdeSettings["continueTestEnvironment"] + >("continueTestEnvironment", "none"), pauseCodebaseIndexOnStart: settings.get( "pauseCodebaseIndexOnStart", false, diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index 9e6da728d..b49960919 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -1,8 +1,8 @@ import fs from "fs"; -import { IContextProvider } from "core"; +import { IContextProvider, IdeSettings } from "core"; import { ConfigHandler } from "core/config/ConfigHandler"; -import { controlPlaneEnv, EXTENSION_NAME } from "core/control-plane/env"; +import { EXTENSION_NAME, getControlPlaneEnv } from "core/control-plane/env"; import { Core } from "core/core"; import { FromCoreProtocol, ToCoreProtocol } from "core/protocol"; import { InProcessMessenger } from "core/protocol/messenger"; @@ -294,7 +294,8 @@ export class VsCodeExtension { // When GitHub sign-in status changes, reload config vscode.authentication.onDidChangeSessions(async (e) => { - if (e.provider.id === controlPlaneEnv.AUTH_TYPE) { + const env = await getControlPlaneEnv(this.ide.getIdeSettings()); + if (e.provider.id === env.AUTH_TYPE) { vscode.commands.executeCommand( "setContext", "continue.isSignedInToControlPlane", @@ -374,6 +375,9 @@ export class VsCodeExtension { void this.core.invoke("didChangeActiveTextEditor", { filepath }); }); + const originalValue = vscode.workspace + .getConfiguration(EXTENSION_NAME) + .get("continueTestEnvironment"); vscode.workspace.onDidChangeConfiguration(async (event) => { if (event.affectsConfiguration(EXTENSION_NAME)) { const settings = this.ide.getIdeSettingsSync(); @@ -381,6 +385,10 @@ export class VsCodeExtension { void webviewProtocol.request("didChangeIdeSettings", { settings, }); + + if (settings.continueTestEnvironment !== originalValue) { + await vscode.commands.executeCommand("workbench.action.reloadWindow"); + } } }); } diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index a22c4934a..a150d2cd8 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -1,7 +1,7 @@ import crypto from "crypto"; import { ControlPlaneSessionInfo } from "core/control-plane/client"; -import { controlPlaneEnv } from "core/control-plane/env"; +import { EXTENSION_NAME, getControlPlaneEnvSync } from "core/control-plane/env"; import fetch from "node-fetch"; import { v4 as uuidv4 } from "uuid"; import { @@ -17,13 +17,22 @@ import { Uri, UriHandler, window, + workspace, } from "vscode"; +import { IdeSettings } from "core"; import { PromiseAdapter, promiseFromEvent } from "./promiseUtils"; import { SecretStorage } from "./SecretStorage"; const AUTH_NAME = "Continue"; +const controlPlaneEnv = getControlPlaneEnvSync( + workspace + .getConfiguration(EXTENSION_NAME) + .get("continueTestEnvironment") ?? + "none", +); + const SESSIONS_SECRET_KEY = `${controlPlaneEnv.AUTH_TYPE}.sessions`; class UriEventHandler extends EventEmitter implements UriHandler { diff --git a/gui/src/context/Auth.tsx b/gui/src/context/Auth.tsx index 361ee8e0c..c81aa1bc1 100644 --- a/gui/src/context/Auth.tsx +++ b/gui/src/context/Auth.tsx @@ -135,13 +135,16 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ useState(false); useEffect(() => { - ideMessenger.ide.getIdeSettings().then(({ enableControlServerBeta }) => { - setControlServerBetaEnabled(enableControlServerBeta); - dispatch(setLastControlServerBetaEnabledStatus(enableControlServerBeta)); + ideMessenger.ide + .getIdeSettings() + .then(({ enableControlServerBeta, continueTestEnvironment }) => { + const enabled = + enableControlServerBeta || continueTestEnvironment !== "none"; + setControlServerBetaEnabled(enabled); + dispatch(setLastControlServerBetaEnabledStatus(enabled)); - const shouldShowPopup = - !lastControlServerBetaEnabledStatus && enableControlServerBeta; - }); + const shouldShowPopup = !lastControlServerBetaEnabledStatus && enabled; + }); }, []); useWebviewListener( diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 10414fbb7..33ba33f59 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -90,6 +90,12 @@ const initialState: SessionState = { id: "local", title: "Local", errors: undefined, + profileType: "local", + fullSlug: { + ownerSlug: "", + packageSlug: "", + versionSlug: "", + }, }, ], curCheckpointIndex: 0, From fd80c42f7696d2998c9ead4dfc106a92650f9401 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 24 Jan 2025 02:25:38 -0800 Subject: [PATCH 064/111] add local environment to dropdown, other fixes --- core/config/ConfigHandler.ts | 22 +++++++++++----------- core/control-plane/env.ts | 4 +++- core/index.d.ts | 2 +- extensions/vscode/package.json | 3 ++- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 3c217bbb5..343bb9cfc 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -26,7 +26,7 @@ import { } from "./onboarding.js"; import ControlPlaneProfileLoader from "./profile/ControlPlaneProfileLoader.js"; import LocalProfileLoader from "./profile/LocalProfileLoader.js"; -import PlatformProfileLoader from "./profile/PlatformProfileLoader.1.js"; +import PlatformProfileLoader from "./profile/PlatformProfileLoader.js"; import { ProfileDescription, ProfileLifecycleManager, @@ -116,10 +116,7 @@ export class ConfigHandler { this.controlPlaneClient .listAssistants() .then(async (assistants) => { - this.profiles = this.profiles.filter( - (profile) => profile.profileDescription.id === "local", - ); - await Promise.all( + const hubProfiles = await Promise.all( assistants.map(async (assistant) => { let renderedConfig: ConfigYaml | undefined = undefined; if (assistant.configResult.config) { @@ -141,15 +138,18 @@ export class ConfigHandler { this.writeLog, this.reloadConfig.bind(this), ); - this.profiles = [ - ...this.profiles.filter( - (profile) => profile.profileDescription.id === "local", - ), - new ProfileLifecycleManager(profileLoader, this.ide), - ]; + + return new ProfileLifecycleManager(profileLoader, this.ide); }), ); + this.profiles = [ + ...this.profiles.filter( + (profile) => profile.profileDescription.id === "local", + ), + ...hubProfiles, + ]; + this.notifyProfileListeners( this.profiles.map((profile) => profile.profileDescription), ); diff --git a/core/control-plane/env.ts b/core/control-plane/env.ts index fd37c31a8..8f5bb40a4 100644 --- a/core/control-plane/env.ts +++ b/core/control-plane/env.ts @@ -75,7 +75,9 @@ export function getControlPlaneEnvSync( ? "hub" : ideTestEnvironment === "test" ? "test" - : process.env.CONTROL_PLANE_ENV; + : ideTestEnvironment === "local" + ? "local" + : process.env.CONTROL_PLANE_ENV; return env === "local" ? LOCAL_ENV diff --git a/core/index.d.ts b/core/index.d.ts index 998ccb312..03c32a8b5 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -583,7 +583,7 @@ export interface IdeSettings { remoteConfigSyncPeriod: number; userToken: string; enableControlServerBeta: boolean; - continueTestEnvironment: "none" | "production" | "test"; + continueTestEnvironment: "none" | "production" | "test" | "local"; pauseCodebaseIndexOnStart: boolean; enableDebugLogs: boolean; } diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index a6eba5ce7..7fccfb4fc 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -101,7 +101,8 @@ "enum": [ "none", "production", - "test" + "test", + "local" ], "default": "none", "description": "Continue test environment" From bfb2c4f91f11795fd8848b3b7fa57ccabe9fbb80 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 24 Jan 2025 02:35:09 -0800 Subject: [PATCH 065/111] fix type err --- core/core.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/core.ts b/core/core.ts index 9211f9366..cf24053b4 100644 --- a/core/core.ts +++ b/core/core.ts @@ -52,9 +52,9 @@ import { type IndexingProgressUpdate, } from "."; +import { getControlPlaneEnv } from "./control-plane/env"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import type { IMessenger, Message } from "./protocol/messenger"; -import { controlPlaneEnv } from "./control-plane/env"; export class Core { // implements IMessenger @@ -298,10 +298,8 @@ export class Core { }); on("controlPlane/openUrl", async (msg) => { - await this.messenger.request( - "openUrl", - `${controlPlaneEnv.APP_URL}${msg.data.path}`, - ); + const env = await getControlPlaneEnv(this.ide.getIdeSettings()); + await this.messenger.request("openUrl", `${env.APP_URL}${msg.data.path}`); }); // Context providers From 3c55f600aae9cbe8b03df49c56ae1fb42addc398 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 24 Jan 2025 02:35:56 -0800 Subject: [PATCH 066/111] bump version --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 7fccfb4fc..fd5f55a70 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.254", + "version": "0.9.255", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From eb8f9b15ba40da309c2f9897ff0902feb9086c2c Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 24 Jan 2025 09:53:05 -0800 Subject: [PATCH 067/111] migrate shared config --- core/config/load.ts | 14 +- core/config/migrateSharedConfig.ts | 165 ++++++++++++++++++ core/config/profile/doLoadConfig.ts | 10 +- core/config/sharedConfig.ts | 129 ++++++++++++-- core/config/yaml/loadYaml.ts | 30 ++-- core/index.d.ts | 1 + core/protocol/core.ts | 2 +- core/protocol/passThrough.ts | 1 + docs/docs/reference.md | 8 + .../constants/MessageTypes.kt | 1 + extensions/vscode/src/commands.ts | 6 +- gui/src/components/gui/Switch.tsx | 37 ++++ gui/src/index.css | 1 + gui/src/pages/config/index.tsx | 160 ++++++++++++++++- 14 files changed, 513 insertions(+), 52 deletions(-) create mode 100644 core/config/migrateSharedConfig.ts create mode 100644 gui/src/components/gui/Switch.tsx diff --git a/core/config/load.ts b/core/config/load.ts index 52cb8cfb9..a7244a79e 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -74,8 +74,9 @@ import { getSystemPromptDotFile } from "./getSystemPromptDotFile"; // import { isSupportedLanceDbCpuTarget } from "./util"; import { validateConfig } from "./validation.js"; import { localPathToUri } from "../util/pathToUri"; +import { modifyContinueConfigWithSharedConfig } from "./sharedConfig"; -function resolveSerializedConfig(filepath: string): SerializedContinueConfig { +export function resolveSerializedConfig(filepath: string): SerializedContinueConfig { let content = fs.readFileSync(filepath, "utf8"); const config = JSONC.parse(content) as unknown as SerializedContinueConfig; if (config.env && Array.isArray(config.env)) { @@ -582,6 +583,7 @@ function finalToBrowserConfig( docs: final.docs, tools: final.tools, usePlatform: usePlatform(), + tabAutocompleteOptions: final.tabAutocompleteOptions, }; } @@ -797,8 +799,16 @@ async function loadContinueConfigFromJson( serialized.systemMessage = systemPromptDotFile; } + // Apply shared config + // TODO: override several of these values with user/org shared config + const sharedConfig = new GlobalContext().getSharedConfig(); + const withShared = modifyContinueConfigWithSharedConfig( + serialized, + sharedConfig, + ); + // Convert serialized to intermediate config - let intermediate = await serializedToIntermediateConfig(serialized, ide); + let intermediate = await serializedToIntermediateConfig(withShared, ide); // Apply config.ts to modify intermediate config const configJsContents = await buildConfigTsandReadConfigJs(ide, ideType); diff --git a/core/config/migrateSharedConfig.ts b/core/config/migrateSharedConfig.ts new file mode 100644 index 000000000..c04696d10 --- /dev/null +++ b/core/config/migrateSharedConfig.ts @@ -0,0 +1,165 @@ +import * as fs from "fs"; + +import * as JSONC from "comment-json"; + +import { IDE, SerializedContinueConfig } from ".."; +import { SharedConfigSchema } from "./sharedConfig"; +import { GlobalContext } from "../util/GlobalContext"; +import { editConfigJson } from "../util/paths"; +import { resolveSerializedConfig } from "./load"; + +/* + This migration function eliminates deprecated values from the json file + And writes them to the shared config +*/ +export function migrateJsonSharedConfig(filepath: string, ide: IDE): void { + try { + let config = resolveSerializedConfig(filepath); + const shareConfigUpdates: SharedConfigSchema = {}; + + let effected = false; + + const { allowAnonymousTelemetry, ...withoutAllowTelemetry } = config; + if (allowAnonymousTelemetry !== undefined) { + shareConfigUpdates.allowAnonymousTelemetry = allowAnonymousTelemetry; + config = withoutAllowTelemetry; + effected = true; + } + + const { disableIndexing, ...withoutDisableIndexing } = config; + if (disableIndexing !== undefined) { + shareConfigUpdates.disableIndexing = disableIndexing; + config = withoutDisableIndexing; + effected = true; + } + + const { disableSessionTitles, ...withoutDisableSessionTitles } = config; + if (config.disableSessionTitles !== undefined) { + shareConfigUpdates.disableSessionTitles = config.disableSessionTitles; + config = withoutDisableSessionTitles; + effected = true; + } + + const { tabAutocompleteOptions, ...withoutAutocompleteOptions } = config; + if (tabAutocompleteOptions !== undefined) { + let migratedAutocomplete = { ...tabAutocompleteOptions }; + + const { useCache, ...withoutUseCache } = migratedAutocomplete; + if (useCache !== undefined) { + shareConfigUpdates.useAutocompleteCache = useCache; + migratedAutocomplete = withoutUseCache; + effected = true; + } + + const { multilineCompletions, ...withoutMultiline } = + migratedAutocomplete; + if (multilineCompletions !== undefined) { + shareConfigUpdates.useAutocompleteMultilineCompletions = + multilineCompletions; + migratedAutocomplete = withoutMultiline; + effected = true; + } + + const { disableInFiles, ...withoutDisableInFiles } = migratedAutocomplete; + if (disableInFiles !== undefined) { + shareConfigUpdates.disableAutocompleteInFiles = disableInFiles; + migratedAutocomplete = withoutDisableInFiles; + effected = true; + } + + config = { + ...withoutAutocompleteOptions, + tabAutocompleteOptions: migratedAutocomplete, + }; + } + + const { experimental, ...withoutExperimental } = config; + if (experimental !== undefined) { + let migratedExperimental = { ...experimental }; + + const { useChromiumForDocsCrawling, ...rest10 } = migratedExperimental; + if (useChromiumForDocsCrawling !== undefined) { + shareConfigUpdates.useChromiumForDocsCrawling = + useChromiumForDocsCrawling; + migratedExperimental = rest10; + effected = true; + } + + const { promptPath, ...withoutPromptPath } = migratedExperimental; + if (promptPath !== undefined) { + shareConfigUpdates.promptPath = promptPath; + migratedExperimental = withoutPromptPath; + effected = true; + } + + const { readResponseTTS, ...withoutReadTTS } = migratedExperimental; + if (readResponseTTS !== undefined) { + shareConfigUpdates.readResponseTTS = readResponseTTS; + migratedExperimental = withoutReadTTS; + effected = true; + } + + config = { + ...withoutExperimental, + experimental: migratedExperimental, + }; + } + + const { ui, ...withoutUI } = config; + if (ui !== undefined) { + let migratedUI = { ...ui }; + + const { codeBlockToolbarPosition, ...withoutToolbarPosition } = + migratedUI; + if (codeBlockToolbarPosition !== undefined) { + shareConfigUpdates.codeBlockToolbarPosition = codeBlockToolbarPosition; + migratedUI = withoutToolbarPosition; + effected = true; + } + + const { fontSize, ...withoutFontSize } = migratedUI; + if (fontSize !== undefined) { + shareConfigUpdates.fontSize = fontSize; + migratedUI = withoutFontSize; + effected = true; + } + + const { codeWrap, ...withoutCodeWrap } = migratedUI; + if (codeWrap !== undefined) { + shareConfigUpdates.codeWrap = codeWrap; + migratedUI = withoutCodeWrap; + effected = true; + } + + const { displayRawMarkdown, ...withoutMD } = migratedUI; + if (displayRawMarkdown !== undefined) { + shareConfigUpdates.displayRawMarkdown = displayRawMarkdown; + migratedUI = withoutMD; + effected = true; + } + + const { showChatScrollbar, ...withoutShowChatScrollbar } = migratedUI; + if (showChatScrollbar !== undefined) { + shareConfigUpdates.showChatScrollbar = showChatScrollbar; + migratedUI = withoutShowChatScrollbar; + effected = true; + } + + config = { + ...withoutUI, + ui: migratedUI, + }; + } + + if (effected) { + new GlobalContext().updateSharedConfig(shareConfigUpdates); + void ide.showToast( + "warning", + "Migrated deprecated Continue JSON settings. Edit in the Config Page", + ); + editConfigJson(() => config); + } + } catch (e) { + throw new Error(`Migration: Failed to parse config.json: ${e}`); + } +} diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index b4f3d5d35..b82cf7c21 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -17,12 +17,13 @@ import { ControlPlaneClient } from "../../control-plane/client.js"; import { controlPlaneEnv } from "../../control-plane/env.js"; import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js"; import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; -import { getConfigYamlPath } from "../../util/paths"; +import { getConfigJsonPath, getConfigYamlPath } from "../../util/paths"; import { Telemetry } from "../../util/posthog"; import { TTS } from "../../util/tts"; import { loadContinueConfigFromJson } from "../load"; import { loadContinueConfigFromYaml } from "../yaml/loadYaml"; import { PlatformConfigMetadata } from "./PlatformProfileLoader"; +import { migrateJsonSharedConfig } from "../migrateSharedConfig"; export default async function doLoadConfig( ide: IDE, @@ -40,6 +41,13 @@ export default async function doLoadConfig( const ideSettings = await ideSettingsPromise; const workOsAccessToken = await controlPlaneClient.getAccessToken(); + // Migrations for old config files + // Removes + const configJsonPath = getConfigJsonPath(ideInfo.ideType); + if (fs.existsSync(configJsonPath)) { + migrateJsonSharedConfig(configJsonPath, ide); + } + const configYamlPath = getConfigYamlPath(ideInfo.ideType); let newConfig: ContinueConfig | undefined; diff --git a/core/config/sharedConfig.ts b/core/config/sharedConfig.ts index 23a0e1c2f..9f2335243 100644 --- a/core/config/sharedConfig.ts +++ b/core/config/sharedConfig.ts @@ -1,30 +1,33 @@ import z from "zod"; - -const sharedConfigTabAutoCompleteOptionsSchema = z - .object({ - disable: z.boolean(), - useCache: z.boolean(), - disableInFiles: z.array(z.string()), - multilineCompletions: z.enum(["always", "never", "auto"]), - }) - .partial(); +import { + BrowserSerializedContinueConfig, + ContinueConfig, + Config, + SerializedContinueConfig, +} from ".."; export const sharedConfigSchema = z .object({ allowAnonymousTelemetry: z.boolean(), disableIndexing: z.boolean(), disableSessionTitles: z.boolean(), + + // `experimental` in `ContinueConfig` useChromiumForDocsCrawling: z.boolean(), readResponseTTS: z.boolean(), promptPath: z.string(), - tabAutocompleteOptions: sharedConfigTabAutoCompleteOptionsSchema, - // UI-only, and user-specific: + // `ui` in `ContinueConfig` codeBlockToolbarPosition: z.enum(["top", "bottom"]), fontSize: z.number(), codeWrap: z.boolean(), displayRawMarkdown: z.boolean(), showChatScrollbar: z.boolean(), + + // `tabAutocompleteOptions` in `ContinueConfig` + useAutocompleteCache: z.boolean(), + useAutocompleteMultilineCompletions: z.enum(["always", "never", "auto"]), + disableAutocompleteInFiles: z.array(z.string()), }) .partial(); @@ -51,13 +54,109 @@ export function salvageSharedConfig(sharedConfig: object): SharedConfigSchema { salvagedConfig.disableSessionTitles = val.data; } } - if ("tabAutocompleteOptions" in sharedConfig) { - const val = sharedConfigTabAutoCompleteOptionsSchema.safeParse( - sharedConfig.tabAutocompleteOptions, + if ("disableAutocompleteInFiles" in sharedConfig) { + const val = sharedConfigSchema.shape.disableAutocompleteInFiles.safeParse( + sharedConfig.disableAutocompleteInFiles, ); if (val.success) { - salvagedConfig.tabAutocompleteOptions = val.data; + salvagedConfig.disableAutocompleteInFiles = val.data; } } return salvagedConfig; } + +export function modifyContinueConfigWithSharedConfig< + T extends + | ContinueConfig + | BrowserSerializedContinueConfig + | Config + | SerializedContinueConfig, +>(continueConfig: T, sharedConfig: SharedConfigSchema): T { + const configCopy = { ...continueConfig }; + configCopy.tabAutocompleteOptions = { + ...configCopy.tabAutocompleteOptions, + }; + if (sharedConfig.useAutocompleteCache !== undefined) { + configCopy.tabAutocompleteOptions.useCache = + sharedConfig.useAutocompleteCache; + } + if (sharedConfig.useAutocompleteMultilineCompletions !== undefined) { + configCopy.tabAutocompleteOptions.multilineCompletions = + sharedConfig.useAutocompleteMultilineCompletions; + } + if (sharedConfig.disableAutocompleteInFiles !== undefined) { + configCopy.tabAutocompleteOptions.disableInFiles = + sharedConfig.disableAutocompleteInFiles; + } + + configCopy.ui = { + ...configCopy.ui, + }; + if (sharedConfig.codeBlockToolbarPosition !== undefined) { + configCopy.ui.codeBlockToolbarPosition = + sharedConfig.codeBlockToolbarPosition; + } + if (sharedConfig.fontSize !== undefined) { + configCopy.ui.fontSize = sharedConfig.fontSize; + } + if (sharedConfig.codeWrap !== undefined) { + configCopy.ui.codeWrap = sharedConfig.codeWrap; + } + if (sharedConfig.displayRawMarkdown !== undefined) { + configCopy.ui.displayRawMarkdown = sharedConfig.displayRawMarkdown; + } + if (sharedConfig.showChatScrollbar !== undefined) { + configCopy.ui.showChatScrollbar = sharedConfig.showChatScrollbar; + } + + if (sharedConfig.allowAnonymousTelemetry !== undefined) { + configCopy.allowAnonymousTelemetry = sharedConfig.allowAnonymousTelemetry; + } + if (sharedConfig.disableIndexing !== undefined) { + configCopy.disableIndexing = sharedConfig.disableIndexing; + } + if (sharedConfig.disableSessionTitles !== undefined) { + configCopy.disableSessionTitles = sharedConfig.disableSessionTitles; + } + + configCopy.experimental = { + ...configCopy.experimental, + }; + if (sharedConfig.promptPath !== undefined) { + configCopy.experimental.promptPath = sharedConfig.promptPath; + } + if (sharedConfig.useChromiumForDocsCrawling !== undefined) { + configCopy.experimental.useChromiumForDocsCrawling = + sharedConfig.useChromiumForDocsCrawling; + } + if (sharedConfig.readResponseTTS !== undefined) { + configCopy.experimental.readResponseTTS = sharedConfig.readResponseTTS; + } + + return configCopy; +} + +// continueConfig.tabAutocompleteOptions = { +// ...continueConfig.tabAutocompleteOptions, +// useCache: sharedConfig.useAutocompleteCache, +// disableInFiles: sharedConfig.disableAutocompleteInFiles, +// multilineCompletions: sharedConfig.useAutocompleteMultilineCompletions, +// }; +// continueConfig.ui = { +// ...continueConfig.ui, +// codeBlockToolbarPosition: sharedConfig.codeBlockToolbarPosition, +// fontSize: sharedConfig.fontSize, +// codeWrap: sharedConfig.codeWrap, +// displayRawMarkdown: sharedConfig.displayRawMarkdown, +// showChatScrollbar: sharedConfig.showChatScrollbar, +// }; +// continueConfig.allowAnonymousTelemetry = sharedConfig.allowAnonymousTelemetry; +// continueConfig.disableIndexing = sharedConfig.disableIndexing; +// continueConfig.disableIndexing = sharedConfig.disableIndexing; +// continueConfig.disableSessionTitles = sharedConfig.disableSessionTitles; +// continueConfig.experimental = { +// ...continueConfig.experimental, +// useChromiumForDocsCrawling: sharedConfig.useChromiumForDocsCrawling, +// readResponseTTS: sharedConfig.readResponseTTS, +// promptPath: sharedConfig.promptPath, +// }; diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index b2fe17945..03a2fdbc7 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -36,6 +36,7 @@ import { allTools } from "../../tools"; import { clientRenderHelper } from "./clientRender"; import { llmsFromModelConfig } from "./models"; import { GlobalContext } from "../../util/GlobalContext"; +import { modifyContinueConfigWithSharedConfig } from "../sharedConfig"; async function loadConfigYaml( workspaceConfigs: string[], @@ -281,25 +282,6 @@ async function configYamlToContinueConfig( clearTimeout(mcpConnectionTimeout); }); - // Apply shared config - // TODO: override several of these values with user/org shared config - const sharedConfig = new GlobalContext().getSharedConfig(); - continueConfig.tabAutocompleteOptions = sharedConfig.tabAutocompleteOptions; - continueConfig.ui = { - codeBlockToolbarPosition: sharedConfig.codeBlockToolbarPosition, - fontSize: sharedConfig.fontSize, - codeWrap: sharedConfig.codeWrap, - displayRawMarkdown: sharedConfig.displayRawMarkdown, - showChatScrollbar: sharedConfig.showChatScrollbar, - }; - continueConfig.allowAnonymousTelemetry = sharedConfig.allowAnonymousTelemetry; - continueConfig.disableIndexing = sharedConfig.disableIndexing; - continueConfig.disableSessionTitles = sharedConfig.disableSessionTitles; - continueConfig.experimental!.useChromiumForDocsCrawling = - sharedConfig.useChromiumForDocsCrawling; - continueConfig.experimental!.readResponseTTS = sharedConfig.readResponseTTS; - continueConfig.experimental!.promptPath = sharedConfig.promptPath; - return continueConfig; } @@ -355,8 +337,16 @@ export async function loadContinueConfigFromYaml( } } + // Apply shared config + // TODO: override several of these values with user/org shared config + const sharedConfig = new GlobalContext().getSharedConfig(); + const withShared = modifyContinueConfigWithSharedConfig( + continueConfig, + sharedConfig, + ); + return { - config: continueConfig, + config: withShared, errors: configYamlResult.errors, configLoadInterrupted: false, }; diff --git a/core/index.d.ts b/core/index.d.ts index aef68e85a..0713f55cb 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1211,6 +1211,7 @@ export interface BrowserSerializedContinueConfig { docs?: SiteIndexingConfig[]; tools: Tool[]; usePlatform: boolean; + tabAutocompleteOptions?: Partial; } // DOCS SUGGESTIONS AND PACKAGE INFO diff --git a/core/protocol/core.ts b/core/protocol/core.ts index 98d2a38dd..fc9344666 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -22,7 +22,7 @@ import type { } from "../"; import { AutocompleteInput } from "../autocomplete/util/types"; import { ProfileDescription } from "../config/ConfigHandler"; -import { SharedConfigSchema } from "../config/SharedConfig"; +import { SharedConfigSchema } from "../config/sharedConfig"; export type OnboardingModes = | "Local" diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index a638eafb4..072426eab 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -23,6 +23,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "config/deleteModel", "config/listProfiles", "config/openProfile", + "config/updateSharedConfig", "context/getContextItems", "context/getSymbolsForFiles", "context/loadSubmenuItems", diff --git a/docs/docs/reference.md b/docs/docs/reference.md index 0f24e2a15..4a8032262 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -446,3 +446,11 @@ Example } } ``` + +### Deprecated settings + +Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the Config Page (Gear Icon) + + +If config.json is +For security purposes, ifsome settings present in `config.json` will always migrated from the old config if any config.json is detected \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt index 9c2b8c2dc..dbc8c457a 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt @@ -80,6 +80,7 @@ class MessageTypes { "config/deleteModel", "config/listProfiles", "config/openProfile", + "config/updateSharedConfig", "context/getContextItems", "context/getSymbolsForFiles", "context/loadSubmenuItems", diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index d8019cfe1..da5e7db94 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -792,10 +792,8 @@ const getCommandsMap: ( vscode.commands.executeCommand("workbench.action.copyEditorToNewWindow"); vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar"); }, - "continue.openConfig": () => { - core.invoke("config/openProfile", { - profileId: undefined, - }); + "continue.openConfigPage": () => { + vscode.commands.executeCommand("continue.navigateTo", "/config", true); }, "continue.selectFilesAsContext": async ( firstUri: vscode.Uri, diff --git a/gui/src/components/gui/Switch.tsx b/gui/src/components/gui/Switch.tsx new file mode 100644 index 000000000..ab71510f2 --- /dev/null +++ b/gui/src/components/gui/Switch.tsx @@ -0,0 +1,37 @@ +import React from "react"; + +type ToggleSwitchProps = { + isToggled: boolean; + onToggle: () => void; + text: string; +}; + +const ToggleSwitch: React.FC = ({ + isToggled, + onToggle, + text, +}) => { + return ( +