From b5705c1d5fc0103b7ab849855cd8b90041551ff1 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 9 Jan 2025 10:10:24 +0000 Subject: [PATCH 01/57] 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 02/57] 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 03/57] 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 04/57] 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 05/57] 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 06/57] 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 07/57] 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 08/57] 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 09/57] 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 1dbee13719321a14e6005151b4c1dc5c0682806d Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Mon, 20 Jan 2025 14:16:58 -0800 Subject: [PATCH 10/57] 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 d166bcd8354a835fded45aa3eff82f34f7e769b9 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 21 Jan 2025 09:54:21 -0800 Subject: [PATCH 11/57] 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 22d84ae726c40d65449c39b2ece4101f32608870 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Tue, 21 Jan 2025 11:57:11 -0800 Subject: [PATCH 12/57] 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 c929865f6cf16b51f3faa6d32a132f203fb87947 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:10:08 -0800 Subject: [PATCH 13/57] 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 14/57] 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 15/57] 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 16/57] 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 4955a6fa1a58745bcd83d281489111f2faf775f6 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:24:09 -0800 Subject: [PATCH 17/57] 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 18/57] 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 b729174dff8cb8d172e23b0256abffa0fb54c106 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 15:57:00 -0800 Subject: [PATCH 19/57] 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 105bb380349e603467449c3f0d8b7016d5bed767 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 21 Jan 2025 16:05:58 -0800 Subject: [PATCH 20/57] 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 21/57] 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 22/57] 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 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 23/57] 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 412a0b78fb4466e5712f2bb49b60be85517b6e34 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 23 Jan 2025 10:47:10 -0800 Subject: [PATCH 24/57] 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 25/57] 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 dae89dea1bf7a0a644a7476fd6dd14976da489b3 Mon Sep 17 00:00:00 2001 From: German Swan Date: Fri, 24 Jan 2025 22:31:26 +0200 Subject: [PATCH 26/57] 3832: DeepSeek-R1 reasoning display can be toggled --- core/index.d.ts | 6 ++ extensions/vscode/package-lock.json | 4 +- .../components/StepContainer/Reasoning.tsx | 64 +++++++++++++++++++ .../StepContainer/StepContainer.tsx | 15 +++-- .../markdown/StyledMarkdownPreview.tsx | 10 ++- gui/src/redux/slices/sessionSlice.ts | 21 +++++- 6 files changed, 108 insertions(+), 12 deletions(-) create mode 100644 gui/src/components/StepContainer/Reasoning.tsx diff --git a/core/index.d.ts b/core/index.d.ts index 03c32a8b5..3a94202a2 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -425,6 +425,11 @@ interface ToolCallState { output?: ContextItem[]; } +interface Reasoning { + active: boolean; + text: string; +} + export interface ChatHistoryItem { message: ChatMessage; contextItems: ContextItemWithId[]; @@ -435,6 +440,7 @@ export interface ChatHistoryItem { isGatheringContext?: boolean; checkpoint?: Checkpoint; isBeforeCheckpoint?: boolean; + reasoning?: Reasoning; } export interface LLMFullCompletionOptions extends BaseCompletionOptions { diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 38d0db7c8..c9d9e1741 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.255", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.254", + "version": "0.9.255", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3", diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx new file mode 100644 index 000000000..23da63cc5 --- /dev/null +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -0,0 +1,64 @@ +import { ChatHistoryItem } from "core"; +import { stripImages } from "core/util/messageContent"; +import { useState } from "react"; +import styled from "styled-components"; +import { defaultBorderRadius, lightGray, vscBackground, vscQuickInputBackground, } from ".."; +import { getFontSize } from "../../util"; +import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; + +interface ReasoningProps { + item: ChatHistoryItem; + index: number; + isLast: boolean; +} + +const SpoilerButton = styled.div` + background-color: ${vscBackground}; + width: fit-content; + font-size: ${getFontSize() - 2}px; + border: 0.5px solid ${lightGray}; + border-radius: ${defaultBorderRadius}; + padding: 4px 8px; + color: ${lightGray}; + cursor: pointer; + box-shadow: + 0 4px 6px rgba(0, 0, 0, 0.1), + 0 1px 3px rgba(0, 0, 0, 0.08); + transition: box-shadow 0.3s ease; + + &:hover { + box-shadow: + 0 6px 8px rgba(0, 0, 0, 0.15), + 0 3px 6px rgba(0, 0, 0, 0.1); + } +`; + +const ContentDiv = styled.div<{ fontSize?: number }>` + margin: 4px; + padding: 4px; + font-size: ${getFontSize()}px; + overflow: hidden; + border-left: 4px solid ${lightGray}; + border-radius: ${defaultBorderRadius}; + background-color: ${vscQuickInputBackground}; +`; + +export default function Reasoning(props: ReasoningProps) { + const [open, setOpen] = useState(false); + + if (!props.item.reasoning?.text) { + return null; + } + + return <> + setOpen(!open)}> {open ? "Hide reasoning" : "Show reasoning"} + {open && ( + + )} + +} diff --git a/gui/src/components/StepContainer/StepContainer.tsx b/gui/src/components/StepContainer/StepContainer.tsx index 5709f7f60..b395db076 100644 --- a/gui/src/components/StepContainer/StepContainer.tsx +++ b/gui/src/components/StepContainer/StepContainer.tsx @@ -11,6 +11,7 @@ import { getFontSize } from "../../util"; import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; import ResponseActions from "./ResponseActions"; import ThinkingIndicator from "./ThinkingIndicator"; +import Reasoning from "./Reasoning"; interface StepContainerProps { item: ChatHistoryItem; @@ -90,11 +91,15 @@ export default function StepContainer(props: StepContainerProps) { {renderChatMessage(props.item.message)} ) : ( - + <> + + + + )} {props.isLast && } diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx index 52d343fe4..931c8c045 100644 --- a/gui/src/components/markdown/StyledMarkdownPreview.tsx +++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx @@ -34,6 +34,7 @@ import { remarkTables } from "./utils/remarkTables"; const StyledMarkdown = styled.div<{ fontSize?: number; whiteSpace: string; + bgColor: string; }>` pre { white-space: ${(props) => props.whiteSpace}; @@ -63,7 +64,7 @@ const StyledMarkdown = styled.div<{ color: #f78383; } - background-color: ${vscBackground}; + background-color: ${(props) => props.bgColor}; font-family: var(--vscode-font-family), system-ui, @@ -104,6 +105,7 @@ interface StyledMarkdownPreviewProps { isRenderingInStepContainer?: boolean; // Currently only used to control the rendering of codeblocks scrollLocked?: boolean; itemIndex?: number; + useParentBackgroundColor?: boolean; } const HLJS_LANGUAGE_CLASSNAME_PREFIX = "language-"; @@ -332,7 +334,11 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( const uiConfig = useAppSelector(selectUIConfig); const codeWrapState = uiConfig?.codeWrap ? "pre-wrap" : "pre"; return ( - + {reactContent} ); diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 33ba33f59..1aa66b438 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -362,9 +362,24 @@ export const sessionSlice = createSlice({ } else { // Add to the existing message if (message.content) { - // Note this only works because new message above - // was already rendered from parts to string - lastMessage.content += renderChatMessage(message); + const messageContent = renderChatMessage(message); + if (messageContent.includes("")) { + lastItem.reasoning = { + active: true, + text: messageContent.replace("", "").trim(), + } + } else if (lastItem.reasoning?.active && messageContent.includes("")) { + const [reasoningEnd, answerStart] = messageContent.split(""); + lastItem.reasoning.text += reasoningEnd.trimEnd(); + lastItem.reasoning.active = false; + lastMessage.content += answerStart.trimStart(); + } else if (lastItem.reasoning?.active) { + lastItem.reasoning.text += messageContent; + } else { + // Note this only works because new message above + // was already rendered from parts to string + lastMessage.content += messageContent; + } } else if ( message.role === "assistant" && message.toolCalls?.[0] && From d67a0a025974bb1561335a0d5f3e999e7a1af964 Mon Sep 17 00:00:00 2001 From: German Swan Date: Fri, 24 Jan 2025 23:08:03 +0200 Subject: [PATCH 27/57] 3832: added elapsed time --- core/index.d.ts | 2 ++ .../components/StepContainer/Reasoning.tsx | 19 +++++++++++++++++-- gui/src/redux/slices/sessionSlice.ts | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/index.d.ts b/core/index.d.ts index 3a94202a2..9dc670da5 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -428,6 +428,8 @@ interface ToolCallState { interface Reasoning { active: boolean; text: string; + startAt: number; + endAt?: number; } export interface ChatHistoryItem { diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx index 23da63cc5..c817111f4 100644 --- a/gui/src/components/StepContainer/Reasoning.tsx +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -1,6 +1,6 @@ import { ChatHistoryItem } from "core"; import { stripImages } from "core/util/messageContent"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import styled from "styled-components"; import { defaultBorderRadius, lightGray, vscBackground, vscQuickInputBackground, } from ".."; import { getFontSize } from "../../util"; @@ -45,13 +45,28 @@ const ContentDiv = styled.div<{ fontSize?: number }>` export default function Reasoning(props: ReasoningProps) { const [open, setOpen] = useState(false); + const [reasoningTime, setReasoningTime] = useState(""); + + useEffect(() => { + if (!props.item.reasoning) return; + + const interval = setInterval(() => { + const startAt = props.item.reasoning?.startAt || Date.now(); + const endAt = props.item.reasoning?.endAt || Date.now(); + const diff = endAt - startAt; + const diffString = `${(diff / 1000).toFixed(1)}s`; + setReasoningTime(diffString) + }, 100); + + return () => clearInterval(interval); + }, [props.item.reasoning?.startAt, props.item.reasoning?.endAt]) if (!props.item.reasoning?.text) { return null; } return <> - setOpen(!open)}> {open ? "Hide reasoning" : "Show reasoning"} + setOpen(!open)}> {open ? "Hide" : "Show"} reasoning: {reasoningTime} {open && ( ")) { lastItem.reasoning = { + startAt: Date.now(), active: true, text: messageContent.replace("", "").trim(), } @@ -372,6 +373,7 @@ export const sessionSlice = createSlice({ const [reasoningEnd, answerStart] = messageContent.split(""); lastItem.reasoning.text += reasoningEnd.trimEnd(); lastItem.reasoning.active = false; + lastItem.reasoning.endAt = Date.now(); lastMessage.content += answerStart.trimStart(); } else if (lastItem.reasoning?.active) { lastItem.reasoning.text += messageContent; From 1870f3f165c2469f01a7520ca4333d13584a69c4 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 24 Jan 2025 17:52:26 -0800 Subject: [PATCH 28/57] assistant + block schemas --- packages/config-yaml/src/schemas/index.ts | 67 +++++++++++++++-------- 1 file changed, 43 insertions(+), 24 deletions(-) diff --git a/packages/config-yaml/src/schemas/index.ts b/packages/config-yaml/src/schemas/index.ts index 394c1dd41..0d540f484 100644 --- a/packages/config-yaml/src/schemas/index.ts +++ b/packages/config-yaml/src/schemas/index.ts @@ -1,25 +1,21 @@ import * as z from "zod"; import { modelSchema } from "./models.js"; -const packageSchema = z.object({ - uses: z.string(), - with: z.any().optional(), -}); - export const dataSchema = z.object({ - provider: z.string(), + destination: z.string(), + levels: z.string().optional(), }); export const contextSchema = z.object({ - uses: z.string(), - with: z.any().optional(), + provider: z.string(), + params: z.any().optional(), }); const toolSchema = z.object({ name: z.string(), description: z.string(), - url: z.string(), - apiKey: z.string().optional(), + run: z.string(), + params: z.any().optional(), }); const mcpServerSchema = z.object({ @@ -42,24 +38,47 @@ const docSchema = z.object({ faviconUrl: z.string().optional(), }); -export const configYamlSchema = z.object({ +export const blockItemWrapperSchema = (schema: T) => + z.object({ + uses: z.string(), + with: z.record(z.string()).optional(), + override: schema.optional(), + }); + +export const blockOrSchema = (schema: T) => + z.union([schema, blockItemWrapperSchema(schema)]); + +export const assistantSchema = z.object({ name: z.string(), version: z.string(), - packages: z.array(packageSchema).optional(), - models: z.array(modelSchema).optional(), - context: z.array(contextSchema).optional(), - data: z.array(dataSchema).optional(), - tools: z.array(toolSchema).optional(), - mcpServers: z.array(mcpServerSchema).optional(), + models: z.array(blockOrSchema(modelSchema)).optional(), + context: z.array(blockOrSchema(contextSchema)).optional(), + data: z.array(blockOrSchema(dataSchema)).optional(), + tools: z.array(blockOrSchema(toolSchema)).optional(), + mcpServers: z.array(blockOrSchema(mcpServerSchema)).optional(), rules: z.array(z.string()).optional(), - prompts: z.array(promptSchema).optional(), - docs: z.array(docSchema).optional(), + prompts: z.array(blockOrSchema(promptSchema)).optional(), + docs: z.array(blockOrSchema(docSchema)).optional(), }); -export type ConfigYaml = z.infer; +export type Assistant = z.infer; -export const unrolledConfigYamlSchema = configYamlSchema.omit({ - packages: true, -}); +export const blockSchema = z + .object({ + name: z.string(), + version: z.string(), + }) + .and( + z.union([ + z.object({ models: z.array(modelSchema).length(1) }), + z.object({ context: z.array(contextSchema).length(1) }), + z.object({ data: z.array(dataSchema).length(1) }), + z.object({ tools: z.array(toolSchema).length(1) }), + z.object({ mcpServers: z.array(mcpServerSchema).length(1) }), + z.object({ rules: z.array(z.string()).length(1) }), + z.object({ prompts: z.array(promptSchema).length(1) }), + z.object({ docs: z.array(docSchema).length(1) }), + ]), + ); -export type UnrolledConfigYaml = z.infer; +export type Block = z.infer; From 368f9653cbcf691636fa48014b0e920ff9257a73 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 24 Jan 2025 17:52:35 -0800 Subject: [PATCH 29/57] rename --- packages/config-yaml/src/converter.ts | 16 ++++++++-------- packages/config-yaml/src/load/clientRender.ts | 6 +++--- packages/config-yaml/src/load/merge.ts | 8 ++++---- packages/config-yaml/src/load/unroll.ts | 14 +++++++------- packages/config-yaml/src/validation.ts | 8 +++----- 5 files changed, 25 insertions(+), 27 deletions(-) diff --git a/packages/config-yaml/src/converter.ts b/packages/config-yaml/src/converter.ts index 56d5326d2..4fb1d5f7d 100644 --- a/packages/config-yaml/src/converter.ts +++ b/packages/config-yaml/src/converter.ts @@ -1,10 +1,10 @@ import { ConfigJson } from "@continuedev/config-types"; -import { ConfigYaml } from "./schemas/index.js"; +import { Assistant } from "./schemas/index.js"; import { ModelRoles } from "./schemas/models.js"; -type ModelYaml = NonNullable[number]; -type ContextYaml = NonNullable[number]; -type PromptYaml = NonNullable[number]; +type ModelYaml = NonNullable[number]; +type ContextYaml = NonNullable[number]; +type PromptYaml = NonNullable[number]; function convertModel( m: ConfigJson["models"][number], @@ -68,7 +68,7 @@ function convertCustomCommand( }; } -function convertMcp(mcp: any): NonNullable[number] { +function convertMcp(mcp: any): NonNullable[number] { const { transport } = mcp; const { command, args, env } = transport; @@ -82,7 +82,7 @@ function convertMcp(mcp: any): NonNullable[number] { function convertDoc( doc: NonNullable[number], -): NonNullable[number] { +): NonNullable[number] { return { name: doc.title, startUrl: doc.startUrl, @@ -91,7 +91,7 @@ function convertDoc( }; } -export function convertJsonToYamlConfig(configJson: ConfigJson): ConfigYaml { +export function convertJsonToYamlConfig(configJson: ConfigJson): Assistant { // models const models = configJson.models.map((m) => convertModel(m, ["chat"])); const autocompleteModels = Array.isArray(configJson.tabAutocompleteModel) @@ -126,7 +126,7 @@ export function convertJsonToYamlConfig(configJson: ConfigJson): ConfigYaml { // docs const docs = configJson.docs?.map(convertDoc); - const configYaml: ConfigYaml = { + const configYaml: Assistant = { name: "Continue Config", version: "0.0.1", models, diff --git a/packages/config-yaml/src/load/clientRender.ts b/packages/config-yaml/src/load/clientRender.ts index cf9b6ba91..c32753b1e 100644 --- a/packages/config-yaml/src/load/clientRender.ts +++ b/packages/config-yaml/src/load/clientRender.ts @@ -5,7 +5,7 @@ import { SecretLocation, } from "../interfaces/SecretResult.js"; import { decodeFQSN, encodeFQSN, FQSN } from "../interfaces/slugs.js"; -import { ConfigYaml } from "../schemas/index.js"; +import { Assistant } from "../schemas/index.js"; import { fillTemplateVariables, getTemplateVariables, @@ -16,7 +16,7 @@ export async function clientRender( unrolledConfigContent: string, secretStore: SecretStore, platformClient?: PlatformClient, -): Promise { +): Promise { // 1. First we need to get a list of all the FQSNs that are required to render the config const secrets = getTemplateVariables(unrolledConfigContent); @@ -102,7 +102,7 @@ function getUnrenderedSecretLocation( return undefined; } -function useProxyForUnrenderedSecrets(config: ConfigYaml): ConfigYaml { +function useProxyForUnrenderedSecrets(config: Assistant): Assistant { if (config.models) { for (let i = 0; i < config.models.length; i++) { const apiKeyLocation = getUnrenderedSecretLocation( diff --git a/packages/config-yaml/src/load/merge.ts b/packages/config-yaml/src/load/merge.ts index 590572edb..80b4757fa 100644 --- a/packages/config-yaml/src/load/merge.ts +++ b/packages/config-yaml/src/load/merge.ts @@ -1,9 +1,9 @@ -import { ConfigYaml } from "../schemas/index.js"; +import { Assistant } from "../schemas/index.js"; export function mergePackages( - current: ConfigYaml, - incoming: ConfigYaml, -): ConfigYaml { + current: Assistant, + incoming: Assistant, +): Assistant { return { ...current, models: [...(current.models ?? []), ...(incoming.models ?? [])], diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index 54774c5a3..8ec75a3be 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -5,13 +5,13 @@ import { decodeFullSlug, encodePackageSlug, } from "../interfaces/slugs.js"; -import { ConfigYaml, configYamlSchema } from "../schemas/index.js"; +import { Assistant, assistantSchema } from "../schemas/index.js"; import { mergePackages } from "./merge.js"; -export function parseConfigYaml(configYaml: string): ConfigYaml { +export function parseConfigYaml(configYaml: string): Assistant { try { const parsed = YAML.parse(configYaml); - const result = configYamlSchema.parse(parsed); + const result = assistantSchema.parse(parsed); return result; } catch (e: any) { throw new Error(`Failed to parse config yaml: ${e.message}`); @@ -44,10 +44,10 @@ export function fillTemplateVariables( } export async function unrollImportedPackage( - pkgImport: NonNullable[number], + pkgImport: NonNullable[number], parentPackages: PackageSlug[], registry: Registry, -): Promise { +): Promise { const { uses, with: params } = pkgImport; const fullSlug = decodeFullSlug(uses); @@ -121,7 +121,7 @@ export async function unrollPackageFromContent( params: Record | undefined, packagePath: PackageSlug[], registry: Registry, -): Promise { +): Promise { // Collect template data const templateData: TemplateData = { // params are passed from the parent package @@ -160,7 +160,7 @@ export async function unrollPackageFromContent( export async function unrollAssistant( fullSlug: string, registry: Registry, -): Promise { +): Promise { const packageSlug = decodeFullSlug(fullSlug); return await unrollImportedPackage( { diff --git a/packages/config-yaml/src/validation.ts b/packages/config-yaml/src/validation.ts index 7af938d99..8fffa77ff 100644 --- a/packages/config-yaml/src/validation.ts +++ b/packages/config-yaml/src/validation.ts @@ -1,4 +1,4 @@ -import { ConfigYaml, configYamlSchema } from "./schemas/index.js"; +import { Assistant, assistantSchema } from "./schemas/index.js"; export interface ConfigValidationError { fatal: boolean; @@ -11,13 +11,11 @@ export interface ConfigResult { configLoadInterrupted: boolean; } -export function validateConfigYaml( - config: ConfigYaml, -): ConfigValidationError[] { +export function validateConfigYaml(config: Assistant): ConfigValidationError[] { const errors: ConfigValidationError[] = []; try { - configYamlSchema.parse(config); + assistantSchema.parse(config); } catch (e: any) { return [ { From 463122ccfe2b40ab7ff554c713d51a4df68c7382 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 24 Jan 2025 20:45:07 -0800 Subject: [PATCH 30/57] remove legacy config.js --- core/continueServer/interface.ts | 2 +- core/continueServer/stubs/client.ts | 2 +- extensions/vscode/src/stubs/remoteConfig.ts | 11 ++--------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/core/continueServer/interface.ts b/core/continueServer/interface.ts index 3c67aa25e..c6e7ceda2 100644 --- a/core/continueServer/interface.ts +++ b/core/continueServer/interface.ts @@ -22,7 +22,7 @@ export interface IContinueServerClient { connected: boolean; url: URL | undefined; getUserToken(): string | undefined; - getConfig(): Promise<{ configJson: string; configJs: string }>; + getConfig(): Promise<{ configJson: string }>; getFromIndexCache( keys: string[], artifactId: T, diff --git a/core/continueServer/stubs/client.ts b/core/continueServer/stubs/client.ts index 49f02fb65..febed8bbd 100644 --- a/core/continueServer/stubs/client.ts +++ b/core/continueServer/stubs/client.ts @@ -30,7 +30,7 @@ export class ContinueServerClient implements IContinueServerClient { return this.url !== undefined && this.userToken !== undefined; } - public async getConfig(): Promise<{ configJson: string; configJs: string }> { + public async getConfig(): Promise<{ configJson: string }> { const userToken = await this.userToken; const response = await fetch(new URL("sync", this.url).href, { method: "GET", diff --git a/extensions/vscode/src/stubs/remoteConfig.ts b/extensions/vscode/src/stubs/remoteConfig.ts index 719d52db4..ffe1fe89b 100644 --- a/extensions/vscode/src/stubs/remoteConfig.ts +++ b/extensions/vscode/src/stubs/remoteConfig.ts @@ -2,10 +2,7 @@ import * as fs from "fs"; import { ContinueServerClient } from "core/continueServer/stubs/client"; import { EXTENSION_NAME } from "core/control-plane/env"; -import { - getConfigJsPathForRemote, - getConfigJsonPathForRemote, -} from "core/util/paths"; +import { getConfigJsonPathForRemote } from "core/util/paths"; import * as vscode from "vscode"; import { CONTINUE_WORKSPACE_KEY } from "../util/workspaceConfig"; @@ -126,16 +123,12 @@ export class RemoteConfigSync { remoteConfigServerUrl.toString(), userToken, ); - const { configJson, configJs } = await client.getConfig(); + const { configJson } = await client.getConfig(); fs.writeFileSync( getConfigJsonPathForRemote(remoteConfigServerUrl), configJson, ); - fs.writeFileSync( - getConfigJsPathForRemote(remoteConfigServerUrl), - configJs, - ); this.triggerReloadConfig(); } catch (e) { vscode.window.showWarningMessage(`Failed to sync remote config: ${e}`); From 3d4984c7c1985f1d65388ca00a14c69a59430fd2 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 25 Jan 2025 14:47:34 -0800 Subject: [PATCH 31/57] update yaml docs for new block syntax --- docs/docs/yaml-migration.md | 14 +++++++------- docs/docs/yaml-reference.md | 35 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/docs/docs/yaml-migration.md b/docs/docs/yaml-migration.md index ad62efaa7..d0679c5ca 100644 --- a/docs/docs/yaml-migration.md +++ b/docs/docs/yaml-migration.md @@ -151,8 +151,8 @@ Note that the `repoMapFileSelection` experimental model role has been deprecated The JSON `contextProviders` field is replaced by the YAML `context` array. -- JSON `name` maps to `uses` -- JSON `params` map to `with` +- JSON `name` maps to `provider` +- JSON `params` map to `params` **Before** @@ -181,14 +181,14 @@ The JSON `contextProviders` field is replaced by the YAML `context` array. ```yaml title="config.yaml" context: - - uses: docs + - provider: docs - - uses: codebase - with: + - provider: codebase + params: nRetrieve: 30 nFinal: 3 - - uses: diff + - params: diff ``` ### System Message @@ -337,7 +337,7 @@ The following top-level fields from `config.json` have been deprecated. Most UI- - `customCommands` - `disableSessionTitles` - `experimental` -- `allowAnonymousTelemetry` (moved to user/IDE level) +- `allowAnonymousTelemetry` (automatically migrated to IDE settings) - `ui` (moved to user/IDE level) - `userToken` - `disableIndexing` (moved to user/IDE level) diff --git a/docs/docs/yaml-reference.md b/docs/docs/yaml-reference.md index b273353a4..e504c95fd 100644 --- a/docs/docs/yaml-reference.md +++ b/docs/docs/yaml-reference.md @@ -6,7 +6,7 @@ keywords: [config, yaml, configuration, customize, customization] # Config YAML Reference - + Continue can be configured using a YAML file `config.yaml` which for local configuration can be placed in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`) @@ -23,7 +23,6 @@ Config YAML does not work alongside `config.json` - it replaces it. View the **[ The top-level properties in the `config.yaml` configuration file are: - [`name`](#name) (**required**) - - [`version`](#version) (**required**) - [`models`](#models) - [`context`](#context) @@ -120,22 +119,22 @@ More information about usage/params for each context provider can be found [here **Properties:** -- `uses` (**required**): The identifier or name of the context provider (e.g., `code`, `docs`, `web`). -- `with`: Optional parameters to configure the context provider's behavior. +- `provider` (**required**): The identifier or name of the context provider (e.g., `code`, `docs`, `web`). +- `params`: Optional parameters to configure the context provider's behavior. **Example:** ```yaml title="config.yaml" context: - - uses: files - - uses: code - - uses: codebase - with: + - provider: files + - provider: code + - provider: codebase + params: nFinal: 10 - - uses: docs - - uses: diff - - uses: folder - - uses: terminal + - provider: docs + - provider: diff + - provider: folder + - provider: terminal ``` --- @@ -301,12 +300,12 @@ prompts: Please write a complete suite of unit tests for this function. You should use the Jest testing framework. The tests should cover all possible edge cases and should be as thorough as possible. You should also include a description of each test case. context: - - uses: diff - - uses: file - - uses: codebase - - uses: code - - uses: docs - with: + - provider: diff + - provider: file + - provider: codebase + - provider: code + - provider: docs + params: startUrl: https://docs.example.com/introduction maxDepth: 3 From 4c554f05f40b5548cfec784247624a8b402e3abb Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 26 Jan 2025 20:49:06 -0800 Subject: [PATCH 32/57] adjust unrolling for blocks --- packages/config-yaml/src/converter.ts | 20 +- packages/config-yaml/src/load/clientRender.ts | 12 +- packages/config-yaml/src/load/merge.ts | 8 +- packages/config-yaml/src/load/unroll.ts | 260 +++++++++++++----- packages/config-yaml/src/schemas/index.ts | 52 +++- packages/config-yaml/src/schemas/models.ts | 16 ++ packages/config-yaml/src/validation.ts | 11 +- packages/config-yaml/test/index.test.ts | 31 ++- .../test/packages/test-org/assistant.yaml | 18 +- .../packages/test-org/claude35sonnet.yaml | 8 + .../test/packages/test-org/docs.yaml | 4 +- .../test/packages/test-org/gemini.yaml | 11 + .../test/packages/test-org/models.yaml | 18 -- .../test/packages/test-org/rules.yaml | 1 - 14 files changed, 326 insertions(+), 144 deletions(-) create mode 100644 packages/config-yaml/test/packages/test-org/claude35sonnet.yaml create mode 100644 packages/config-yaml/test/packages/test-org/gemini.yaml delete mode 100644 packages/config-yaml/test/packages/test-org/models.yaml diff --git a/packages/config-yaml/src/converter.ts b/packages/config-yaml/src/converter.ts index 4fb1d5f7d..a8bc6c3ff 100644 --- a/packages/config-yaml/src/converter.ts +++ b/packages/config-yaml/src/converter.ts @@ -1,10 +1,10 @@ import { ConfigJson } from "@continuedev/config-types"; -import { Assistant } from "./schemas/index.js"; +import { AssistantRolled } from "./schemas/index.js"; import { ModelRoles } from "./schemas/models.js"; -type ModelYaml = NonNullable[number]; -type ContextYaml = NonNullable[number]; -type PromptYaml = NonNullable[number]; +type ModelYaml = NonNullable[number]; +type ContextYaml = NonNullable[number]; +type PromptYaml = NonNullable[number]; function convertModel( m: ConfigJson["models"][number], @@ -68,7 +68,9 @@ function convertCustomCommand( }; } -function convertMcp(mcp: any): NonNullable[number] { +function convertMcp( + mcp: any, +): NonNullable[number] { const { transport } = mcp; const { command, args, env } = transport; @@ -82,7 +84,7 @@ function convertMcp(mcp: any): NonNullable[number] { function convertDoc( doc: NonNullable[number], -): NonNullable[number] { +): NonNullable[number] { return { name: doc.title, startUrl: doc.startUrl, @@ -91,7 +93,9 @@ function convertDoc( }; } -export function convertJsonToYamlConfig(configJson: ConfigJson): Assistant { +export function convertJsonToYamlConfig( + configJson: ConfigJson, +): AssistantRolled { // models const models = configJson.models.map((m) => convertModel(m, ["chat"])); const autocompleteModels = Array.isArray(configJson.tabAutocompleteModel) @@ -126,7 +130,7 @@ export function convertJsonToYamlConfig(configJson: ConfigJson): Assistant { // docs const docs = configJson.docs?.map(convertDoc); - const configYaml: Assistant = { + const configYaml: AssistantRolled = { name: "Continue Config", version: "0.0.1", models, diff --git a/packages/config-yaml/src/load/clientRender.ts b/packages/config-yaml/src/load/clientRender.ts index c32753b1e..75e2f89bb 100644 --- a/packages/config-yaml/src/load/clientRender.ts +++ b/packages/config-yaml/src/load/clientRender.ts @@ -5,18 +5,18 @@ import { SecretLocation, } from "../interfaces/SecretResult.js"; import { decodeFQSN, encodeFQSN, FQSN } from "../interfaces/slugs.js"; -import { Assistant } from "../schemas/index.js"; +import { AssistantUnrolled } from "../schemas/index.js"; import { fillTemplateVariables, getTemplateVariables, - parseConfigYaml, + parseAssistantUnrolled, } from "./unroll.js"; export async function clientRender( unrolledConfigContent: string, secretStore: SecretStore, platformClient?: PlatformClient, -): Promise { +): Promise { // 1. First we need to get a list of all the FQSNs that are required to render the config const secrets = getTemplateVariables(unrolledConfigContent); @@ -71,7 +71,7 @@ export async function clientRender( ); // 6. The rendered YAML is parsed and validated again - const parsedYaml = parseConfigYaml(renderedYaml); + const parsedYaml = parseAssistantUnrolled(renderedYaml); // 7. We update any of the items with the proxy version if there are un-rendered secrets const finalConfig = useProxyForUnrenderedSecrets(parsedYaml); @@ -102,7 +102,9 @@ function getUnrenderedSecretLocation( return undefined; } -function useProxyForUnrenderedSecrets(config: Assistant): Assistant { +function useProxyForUnrenderedSecrets( + config: AssistantUnrolled, +): AssistantUnrolled { if (config.models) { for (let i = 0; i < config.models.length; i++) { const apiKeyLocation = getUnrenderedSecretLocation( diff --git a/packages/config-yaml/src/load/merge.ts b/packages/config-yaml/src/load/merge.ts index 80b4757fa..d808f8c92 100644 --- a/packages/config-yaml/src/load/merge.ts +++ b/packages/config-yaml/src/load/merge.ts @@ -1,9 +1,9 @@ -import { Assistant } from "../schemas/index.js"; +import { AssistantRolled } from "../schemas/index.js"; export function mergePackages( - current: Assistant, - incoming: Assistant, -): Assistant { + current: AssistantRolled, + incoming: AssistantRolled, +): AssistantRolled { return { ...current, models: [...(current.models ?? []), ...(incoming.models ?? [])], diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index 8ec75a3be..a330ebe04 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -1,20 +1,48 @@ import * as YAML from "yaml"; import { Registry } from "../interfaces/index.js"; import { - PackageSlug, decodeFullSlug, encodePackageSlug, + FullSlug, + PackageSlug, } from "../interfaces/slugs.js"; -import { Assistant, assistantSchema } from "../schemas/index.js"; -import { mergePackages } from "./merge.js"; +import { + AssistantRolled, + assistantRolledSchema, + AssistantUnrolled, + assistantUnrolledSchema, + Block, + blockSchema, +} from "../schemas/index.js"; -export function parseConfigYaml(configYaml: string): Assistant { +export function parseAssistantRolled(configYaml: string): AssistantRolled { try { const parsed = YAML.parse(configYaml); - const result = assistantSchema.parse(parsed); + const result = assistantRolledSchema.parse(parsed); return result; } catch (e: any) { - throw new Error(`Failed to parse config yaml: ${e.message}`); + console.log(configYaml); + throw new Error(`Failed to parse rolled assistant: ${e.message}`); + } +} + +export function parseAssistantUnrolled(configYaml: string): AssistantUnrolled { + try { + const parsed = YAML.parse(configYaml); + const result = assistantUnrolledSchema.parse(parsed); + return result; + } catch (e: any) { + throw new Error(`Failed to parse unrolled assistant: ${e.message}`); + } +} + +export function parseBlock(configYaml: string): Block { + try { + const parsed = YAML.parse(configYaml); + const result = blockSchema.parse(parsed); + return result; + } catch (e: any) { + throw new Error(`Failed to parse block: ${e.message}`); } } @@ -43,29 +71,8 @@ export function fillTemplateVariables( }); } -export async function unrollImportedPackage( - pkgImport: NonNullable[number], - parentPackages: PackageSlug[], - registry: Registry, -): Promise { - const { uses, with: params } = pkgImport; - - const fullSlug = decodeFullSlug(uses); - - // Request the content from the registry - const rawContent = await registry.getContent(fullSlug); - - // Convert the raw YAML to unrolled config - return await unrollPackageFromContent( - rawContent, - params, - parentPackages, - registry, - ); -} - export interface TemplateData { - params: Record | undefined; + inputs: Record | undefined; secrets: Record | undefined; continue: {}; } @@ -75,9 +82,9 @@ function flattenTemplateData( ): Record { const flattened: Record = {}; - if (templateData.params) { - for (const [key, value] of Object.entries(templateData.params)) { - flattened[`params.${key}`] = value; + if (templateData.inputs) { + for (const [key, value] of Object.entries(templateData.inputs)) { + flattened[`inputs.${key}`] = value; } } if (templateData.secrets) { @@ -116,57 +123,158 @@ function extractFQSNMap( return secretToFQSNMap(secrets, parentPackages); } -export async function unrollPackageFromContent( - rawContent: string, - params: Record | undefined, - packagePath: PackageSlug[], - registry: Registry, -): Promise { - // Collect template data - const templateData: TemplateData = { - // params are passed from the parent package - params: params, - // at this stage, secrets are mapped to a (still templated) FQSN - secrets: extractFQSNMap(rawContent, packagePath), - // Built-in variables - continue: {}, - }; - - const templatedYaml = fillTemplateVariables( - rawContent, - flattenTemplateData(templateData), - ); - - let parsedYaml = parseConfigYaml(templatedYaml); - - const unrolledChildPackages = await Promise.all( - parsedYaml.packages?.map((pkg) => { - const pkgSlug = decodeFullSlug(pkg.uses); - return unrollImportedPackage(pkg, [...packagePath, pkgSlug], registry); - }) ?? [], - ); - - delete parsedYaml.packages; - for (const childPkg of unrolledChildPackages) { - parsedYaml = mergePackages(parsedYaml, childPkg); - } - - return parsedYaml; -} - /** * Loading an assistant is equivalent to loading a package without params */ export async function unrollAssistant( fullSlug: string, registry: Registry, -): Promise { - const packageSlug = decodeFullSlug(fullSlug); - return await unrollImportedPackage( - { - uses: fullSlug, - }, - [packageSlug], +): Promise { + const assistantSlug = decodeFullSlug(fullSlug); + + // Request the content from the registry + const rawContent = await registry.getContent(assistantSlug); + + // Convert the raw YAML to unrolled config + const templateData: TemplateData = { + // no inputs to an assistant + inputs: {}, + // at this stage, secrets are mapped to a (still templated) FQSN + secrets: extractFQSNMap(rawContent, [assistantSlug]), + // Built-in variables + continue: {}, + }; + + // Render the template + const templatedYaml = fillTemplateVariables( + rawContent, + flattenTemplateData(templateData), + ); + + // Parse string to Zod-validated YAML + let parsedYaml = parseAssistantRolled(templatedYaml); + + // Unroll blocks + const unrolledAssistant = await unrollBlocks( + parsedYaml, + assistantSlug, registry, ); + + return unrolledAssistant; +} + +export async function unrollBlocks( + assistant: AssistantRolled, + assistantFullSlug: FullSlug, + registry: Registry, +): Promise { + const unrolledAssistant: AssistantUnrolled = { + name: assistant.name, + version: assistant.version, + }; + + const sections: (keyof Omit< + AssistantRolled, + "name" | "version" | "rules" + >)[] = [ + "models", + "context", + "data", + "tools", + "mcpServers", + "prompts", + "docs", + ]; + + // For each section, replace "uses/with" blocks with the real thing + for (const section of sections) { + if (assistant[section]) { + const sectionBlocks: any[] = []; + + for (const unrolledBlock of assistant[section]) { + // "uses/with" block + if ("uses" in unrolledBlock) { + const blockConfigYaml = await resolveBlock( + decodeFullSlug(unrolledBlock.uses), + unrolledBlock.with, + assistantFullSlug, + registry, + ); + const block = blockConfigYaml[section]?.[0]; + if (block) { + sectionBlocks.push( + mergeOverrides(block, unrolledBlock.override ?? {}), + ); + } + } else { + // Normal block + sectionBlocks.push(unrolledBlock); + } + } + + unrolledAssistant[section] = sectionBlocks; + } + } + + // Rules are a bit different because they're just strings, so handle separately + if (assistant.rules) { + const rules: string[] = []; + for (const rule of assistant.rules) { + if (typeof rule === "string") { + rules.push(rule); + } else { + const blockConfigYaml = await resolveBlock( + decodeFullSlug(rule.uses), + rule.with, + assistantFullSlug, + registry, + ); + const block = blockConfigYaml.rules?.[0]; + if (block) { + rules.push(block); + } + } + } + + unrolledAssistant.rules = rules; + } + + return unrolledAssistant; +} + +export async function resolveBlock( + fullSlug: FullSlug, + inputs: Record | undefined, + parentFullSlug: FullSlug, + registry: Registry, +): Promise { + // Retrieve block raw yaml + const rawYaml = await registry.getContent(fullSlug); + + // Render template variables + const templateData: TemplateData = { + inputs, + secrets: extractFQSNMap(rawYaml, [parentFullSlug, fullSlug]), + continue: {}, + }; + const templatedYaml = fillTemplateVariables( + rawYaml, + flattenTemplateData(templateData), + ); + + const parsedYaml = parseBlock(templatedYaml); + return parsedYaml; +} + +export function mergeOverrides>( + block: T, + overrides: Partial, +): T { + for (const key in overrides) { + if (overrides.hasOwnProperty(key)) { + block[key] = overrides[key]!; + } + } + return block; } diff --git a/packages/config-yaml/src/schemas/index.ts b/packages/config-yaml/src/schemas/index.ts index 0d540f484..3d0c34bc3 100644 --- a/packages/config-yaml/src/schemas/index.ts +++ b/packages/config-yaml/src/schemas/index.ts @@ -1,5 +1,5 @@ import * as z from "zod"; -import { modelSchema } from "./models.js"; +import { modelSchema, partialModelSchema } from "./models.js"; export const dataSchema = z.object({ destination: z.string(), @@ -38,30 +38,66 @@ const docSchema = z.object({ faviconUrl: z.string().optional(), }); -export const blockItemWrapperSchema = (schema: T) => +export const blockItemWrapperSchema = (schema: T) => z.object({ uses: z.string(), with: z.record(z.string()).optional(), - override: schema.optional(), + override: schema.partial().optional(), }); -export const blockOrSchema = (schema: T) => +export const blockOrSchema = (schema: T) => z.union([schema, blockItemWrapperSchema(schema)]); -export const assistantSchema = z.object({ +export const assistantRolledSchema = z.object({ name: z.string(), version: z.string(), - models: z.array(blockOrSchema(modelSchema)).optional(), + models: z + .array( + z.union([ + modelSchema, + z.object({ + uses: z.string(), + with: z.record(z.string()).optional(), + override: partialModelSchema.optional(), + }), + ]), + ) + .optional(), context: z.array(blockOrSchema(contextSchema)).optional(), data: z.array(blockOrSchema(dataSchema)).optional(), tools: z.array(blockOrSchema(toolSchema)).optional(), mcpServers: z.array(blockOrSchema(mcpServerSchema)).optional(), - rules: z.array(z.string()).optional(), + rules: z + .array( + z.union([ + z.string(), + z.object({ + uses: z.string(), + with: z.record(z.string()).optional(), + }), + ]), + ) + .optional(), prompts: z.array(blockOrSchema(promptSchema)).optional(), docs: z.array(blockOrSchema(docSchema)).optional(), }); -export type Assistant = z.infer; +export type AssistantRolled = z.infer; + +export const assistantUnrolledSchema = z.object({ + name: z.string(), + version: z.string(), + models: z.array(modelSchema).optional(), + context: z.array(contextSchema).optional(), + data: z.array(dataSchema).optional(), + tools: z.array(toolSchema).optional(), + mcpServers: z.array(mcpServerSchema).optional(), + rules: z.array(z.string()).optional(), + prompts: z.array(promptSchema).optional(), + docs: z.array(docSchema).optional(), +}); + +export type AssistantUnrolled = z.infer; export const blockSchema = z .object({ diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index 713d2cc2d..3037d750f 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -64,4 +64,20 @@ export const modelSchema = z.union([ }), ]); +export const partialModelSchema = z.union([ + z + .object({ + ...baseModelFields, + provider: z.literal("continue-proxy"), + apiKeyLocation: z.string(), + }) + .partial(), + z + .object({ + ...baseModelFields, + provider: z.string().refine((val) => val !== "continue-proxy"), + }) + .partial(), +]); + export type ModelConfig = z.infer; diff --git a/packages/config-yaml/src/validation.ts b/packages/config-yaml/src/validation.ts index 8fffa77ff..1fb145ee1 100644 --- a/packages/config-yaml/src/validation.ts +++ b/packages/config-yaml/src/validation.ts @@ -1,4 +1,4 @@ -import { Assistant, assistantSchema } from "./schemas/index.js"; +import { AssistantRolled, assistantRolledSchema } from "./schemas/index.js"; export interface ConfigValidationError { fatal: boolean; @@ -11,11 +11,13 @@ export interface ConfigResult { configLoadInterrupted: boolean; } -export function validateConfigYaml(config: Assistant): ConfigValidationError[] { +export function validateConfigYaml( + config: AssistantRolled, +): ConfigValidationError[] { const errors: ConfigValidationError[] = []; try { - assistantSchema.parse(config); + assistantRolledSchema.parse(config); } catch (e: any) { return [ { @@ -26,6 +28,9 @@ export function validateConfigYaml(config: Assistant): ConfigValidationError[] { } config.models?.forEach((model) => { + if ("uses" in model) { + return; + } // Max tokens not too close to context length if ( model.defaultCompletionOptions?.contextLength && diff --git a/packages/config-yaml/test/index.test.ts b/packages/config-yaml/test/index.test.ts index 3f75ff092..8bba163ce 100644 --- a/packages/config-yaml/test/index.test.ts +++ b/packages/config-yaml/test/index.test.ts @@ -29,7 +29,7 @@ describe("E2E Scenarios", () => { const packageSecrets: Record = { "test-org/assistant/ANTHROPIC_API_KEY": "sk-ant", - "test-org/models/GEMINI_API_KEY": "gemini-api-key", + "test-org/gemini/GEMINI_API_KEY": "gemini-api-key", }; const proxyEnvSecrets: Record = { @@ -100,22 +100,24 @@ describe("E2E Scenarios", () => { ); // Test that packages were correctly unrolled and params replaced - expect(unrolledConfig.models?.length).toBe(4); + expect(unrolledConfig.models?.length).toBe(3); expect(unrolledConfig.models?.[0].apiKey).toBe( "${{ secrets.test-org/assistant/OPENAI_API_KEY }}", ); - expect(unrolledConfig.models?.[1].apiKey).toBe("sk-456"); - expect(unrolledConfig.models?.[2].apiKey).toBe( - "${{ secrets.test-org/assistant/test-org/models/ANTHROPIC_API_KEY }}", + expect(unrolledConfig.models?.[1].apiKey).toBe( + "${{ secrets.test-org/assistant/test-org/gemini/GEMINI_API_KEY }}", ); - expect(unrolledConfig.models?.[3].apiKey).toBe( - "${{ secrets.test-org/assistant/test-org/models/GEMINI_API_KEY }}", + expect(unrolledConfig.models?.[2].apiKey).toBe( + "${{ secrets.test-org/assistant/ANTHROPIC_API_KEY }}", ); - expect(unrolledConfig.rules?.length).toBe(3); + expect(unrolledConfig.rules?.length).toBe(2); expect(unrolledConfig.docs?.[0].startUrl).toBe( "https://docs.python.org/release/3.13.1", ); + expect(unrolledConfig.docs?.[0].rootUrl).toBe( + "https://docs.python.org/release/3.13.1", + ); const clientRendered = await clientRender( YAML.stringify(unrolledConfig), @@ -126,19 +128,18 @@ describe("E2E Scenarios", () => { // Test that user secrets were injected and others were changed to use proxy const anthropicSecretLocation = "package:test-org/assistant/ANTHROPIC_API_KEY"; - const geminiSecretLocation = "package:test-org/models/GEMINI_API_KEY"; + const geminiSecretLocation = "package:test-org/gemini/GEMINI_API_KEY"; expect(clientRendered.models?.[0].apiKey).toBe("sk-123"); - expect(clientRendered.models?.[1].apiKey).toBe("sk-456"); + expect(clientRendered.models?.[1].provider).toBe("continue-proxy"); + expect((clientRendered.models?.[1] as any).apiKeyLocation).toBe( + geminiSecretLocation, + ); + expect(clientRendered.models?.[1].apiKey).toBeUndefined(); expect(clientRendered.models?.[2].provider).toBe("continue-proxy"); expect((clientRendered.models?.[2] as any).apiKeyLocation).toBe( anthropicSecretLocation, ); expect(clientRendered.models?.[2].apiKey).toBeUndefined(); - expect(clientRendered.models?.[3].provider).toBe("continue-proxy"); - expect((clientRendered.models?.[3] as any).apiKeyLocation).toBe( - geminiSecretLocation, - ); - expect(clientRendered.models?.[3].apiKey).toBeUndefined(); // Test that proxy can correctly resolve secrets const decodedAnthropicSecretLocation = decodeSecretLocation( diff --git a/packages/config-yaml/test/packages/test-org/assistant.yaml b/packages/config-yaml/test/packages/test-org/assistant.yaml index 74fefc581..9099af2de 100644 --- a/packages/config-yaml/test/packages/test-org/assistant.yaml +++ b/packages/config-yaml/test/packages/test-org/assistant.yaml @@ -1,12 +1,14 @@ name: Assistant version: 0.0.1 -packages: - - uses: test-org/models +docs: - uses: test-org/docs with: version: 3.13.1 + +rules: - uses: test-org/rules + - Use KaTeX for math models: - name: gpt-5 @@ -14,5 +16,13 @@ models: model: gpt-5 apiKey: ${{ secrets.OPENAI_API_KEY }} -rules: - - Use KaTeX for math + - uses: test-org/gemini + override: + contextLength: 500000 + defaultCompletionOptions: + topP: 1.0 + apiBase: https://example.com + + - uses: test-org/claude35sonnet + with: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} diff --git a/packages/config-yaml/test/packages/test-org/claude35sonnet.yaml b/packages/config-yaml/test/packages/test-org/claude35sonnet.yaml new file mode 100644 index 000000000..0eda292d4 --- /dev/null +++ b/packages/config-yaml/test/packages/test-org/claude35sonnet.yaml @@ -0,0 +1,8 @@ +name: Claude 3.5 sonnet latest +version: 0.0.1 + +models: + - name: claude-3-5-sonnet-latest + provider: anthropic + model: claude-3-5-sonnet-latest + apiKey: ${{ inputs.ANTHROPIC_API_KEY }} diff --git a/packages/config-yaml/test/packages/test-org/docs.yaml b/packages/config-yaml/test/packages/test-org/docs.yaml index 1b540d227..10fa5b631 100644 --- a/packages/config-yaml/test/packages/test-org/docs.yaml +++ b/packages/config-yaml/test/packages/test-org/docs.yaml @@ -3,5 +3,5 @@ version: 0.0.1 docs: - name: Python - startUrl: https://docs.python.org/release/${{ params.version }} - rootUrl: https://docs.python.org/release/${{ params.version }} + startUrl: https://docs.python.org/release/${{ inputs.version }} + rootUrl: https://docs.python.org/release/${{ inputs.version }} diff --git a/packages/config-yaml/test/packages/test-org/gemini.yaml b/packages/config-yaml/test/packages/test-org/gemini.yaml new file mode 100644 index 000000000..6e4ea01b0 --- /dev/null +++ b/packages/config-yaml/test/packages/test-org/gemini.yaml @@ -0,0 +1,11 @@ +name: Gemini +version: 0.0.1 + +models: + - name: gemini + provider: gemini + model: gemini + apiKey: ${{ secrets.GEMINI_API_KEY }} + defaultCompletionOptions: + temperature: 0.7 + contextLength: 1000000 diff --git a/packages/config-yaml/test/packages/test-org/models.yaml b/packages/config-yaml/test/packages/test-org/models.yaml deleted file mode 100644 index f47831662..000000000 --- a/packages/config-yaml/test/packages/test-org/models.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: Models -version: 0.0.1 - -models: - - name: gpt-4 - provider: openai - model: gpt-4 - apiKey: sk-456 - - - name: claude-3-5-sonnet-latest - provider: anthropic - model: claude-3-5-sonnet-latest - apiKey: ${{ secrets.ANTHROPIC_API_KEY }} - - - name: gemini - provider: gemini - model: gemini - apiKey: ${{ secrets.GEMINI_API_KEY }} diff --git a/packages/config-yaml/test/packages/test-org/rules.yaml b/packages/config-yaml/test/packages/test-org/rules.yaml index 2a4f36a9e..4099af2a3 100644 --- a/packages/config-yaml/test/packages/test-org/rules.yaml +++ b/packages/config-yaml/test/packages/test-org/rules.yaml @@ -3,4 +3,3 @@ version: 0.0.1 rules: - Be kind - - Be concise From 938aaeb35f64aab5bec1cf4da06cf6a62d48a582 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 26 Jan 2025 20:55:14 -0800 Subject: [PATCH 33/57] upgrade config-yaml package and update types to match --- core/config/ConfigHandler.ts | 8 ++++++-- core/config/profile/PlatformProfileLoader.ts | 4 ++-- core/config/profile/doLoadConfig.ts | 4 ++-- core/config/yaml/convertFromJson.ts | 8 ++++---- core/config/yaml/default.ts | 6 +++--- core/config/yaml/loadYaml.ts | 21 ++++++++++---------- core/control-plane/client.ts | 4 ++-- core/package-lock.json | 8 ++++---- core/package.json | 2 +- gui/package-lock.json | 10 +++++----- gui/package.json | 2 +- packages/config-yaml/package.json | 2 +- 12 files changed, 42 insertions(+), 37 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 343bb9cfc..6da94b528 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -16,7 +16,11 @@ import Ollama from "../llm/llms/Ollama.js"; import { GlobalContext } from "../util/GlobalContext.js"; import { getConfigJsonPath, getConfigYamlPath } from "../util/paths.js"; -import { ConfigResult, ConfigYaml, FullSlug } from "@continuedev/config-yaml"; +import { + AssistantUnrolled, + ConfigResult, + FullSlug, +} from "@continuedev/config-yaml"; import * as YAML from "yaml"; import { getControlPlaneEnv, useHub } from "../control-plane/env.js"; import { localPathToUri } from "../util/pathToUri.js"; @@ -118,7 +122,7 @@ export class ConfigHandler { .then(async (assistants) => { const hubProfiles = await Promise.all( assistants.map(async (assistant) => { - let renderedConfig: ConfigYaml | undefined = undefined; + let renderedConfig: AssistantUnrolled | undefined = undefined; if (assistant.configResult.config) { renderedConfig = await clientRenderHelper( YAML.stringify(assistant.configResult.config), diff --git a/core/config/profile/PlatformProfileLoader.ts b/core/config/profile/PlatformProfileLoader.ts index f703b2a2c..12e166c2d 100644 --- a/core/config/profile/PlatformProfileLoader.ts +++ b/core/config/profile/PlatformProfileLoader.ts @@ -1,4 +1,4 @@ -import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js"; +import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas/index.js"; import { ControlPlaneClient } from "../../control-plane/client.js"; import { ContinueConfig, IDE, IdeSettings } from "../../index.js"; @@ -24,7 +24,7 @@ export default class PlatformProfileLoader implements IProfileLoader { description: ProfileDescription; constructor( - private configResult: ConfigResult, + private configResult: ConfigResult, private readonly ownerSlug: string, private readonly packageSlug: string, versionSlug: string, diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 3a64ef71c..851015bd2 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -1,9 +1,9 @@ import fs from "fs"; import { + AssistantUnrolled, ConfigResult, ConfigValidationError, - ConfigYaml, } from "@continuedev/config-yaml"; import { ContinueConfig, @@ -30,7 +30,7 @@ export default async function doLoadConfig( controlPlaneClient: ControlPlaneClient, writeLog: (message: string) => Promise, overrideConfigJson: SerializedContinueConfig | undefined, - overrideConfigYaml: ConfigYaml | undefined, + overrideConfigYaml: AssistantUnrolled | undefined, platformConfigMetadata: PlatformConfigMetadata | undefined, workspaceId?: string, ): Promise> { diff --git a/core/config/yaml/convertFromJson.ts b/core/config/yaml/convertFromJson.ts index 4109d7d37..576e196c8 100644 --- a/core/config/yaml/convertFromJson.ts +++ b/core/config/yaml/convertFromJson.ts @@ -1,11 +1,11 @@ import { ModelConfig } from "@continuedev/config-yaml"; -import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas"; +import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas"; import { SerializedContinueConfig } from "../.."; export function convertConfigJsonToConfigYaml( configJson: SerializedContinueConfig, -): ConfigYaml { +): AssistantUnrolled { return { name: "Local Config", version: "1.0.0", @@ -24,8 +24,8 @@ export function convertConfigJsonToConfigYaml( // rerankModels ], context: configJson.contextProviders?.map((provider) => ({ - uses: provider.name, - with: provider.params, + provider: provider.name, + params: provider.params, })), }; } diff --git a/core/config/yaml/default.ts b/core/config/yaml/default.ts index cfdffc12d..0bc872f88 100644 --- a/core/config/yaml/default.ts +++ b/core/config/yaml/default.ts @@ -1,14 +1,14 @@ -import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas"; +import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas"; // TODO -export const defaultConfigYaml: ConfigYaml = { +export const defaultConfigYaml: AssistantUnrolled = { models: [], context: [], name: "Local Config", version: "1.0.0", }; -export const defaultConfigYamlJetBrains: ConfigYaml = { +export const defaultConfigYamlJetBrains: AssistantUnrolled = { models: [], context: [], name: "Local Config", diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index cb1c5ea18..3ce7229a4 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import { + AssistantUnrolled, ConfigResult, - ConfigYaml, validateConfigYaml, } from "@continuedev/config-yaml"; import { fetchwithRequestOptions } from "@continuedev/fetch"; @@ -40,10 +40,10 @@ import { llmsFromModelConfig } from "./models"; async function loadConfigYaml( workspaceConfigs: string[], rawYaml: string, - overrideConfigYaml: ConfigYaml | undefined, + overrideConfigYaml: AssistantUnrolled | undefined, ide: IDE, controlPlaneClient: ControlPlaneClient, -): Promise> { +): Promise> { let config = overrideConfigYaml ?? (await clientRenderHelper(rawYaml, ide, controlPlaneClient)); @@ -86,7 +86,7 @@ async function slashCommandsFromV1PromptFiles( } async function configYamlToContinueConfig( - config: ConfigYaml, + config: AssistantUnrolled, ide: IDE, ideSettings: IdeSettings, uniqueId: string, @@ -181,7 +181,8 @@ async function configYamlToContinueConfig( // Context providers const codebaseContextParams: IContextProvider[] = - (config.context || []).find((cp) => cp.uses === "codebase")?.with || {}; + (config.context || []).find((cp) => cp.provider === "codebase")?.params || + {}; const DEFAULT_CONTEXT_PROVIDERS = [ new FileContextProvider({}), new CodebaseContextProvider(codebaseContextParams), @@ -194,14 +195,14 @@ async function configYamlToContinueConfig( continueConfig.contextProviders = (config.context ?.map((context) => { - const cls = contextProviderClassFromName(context.uses) as any; + const cls = contextProviderClassFromName(context.provider) as any; if (!cls) { - if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.uses)) { - console.warn(`Unknown context provider ${context.uses}`); + if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.provider)) { + console.warn(`Unknown context provider ${context.provider}`); } return undefined; } - const instance: IContextProvider = new cls(context.with ?? {}); + const instance: IContextProvider = new cls(context.params ?? {}); return instance; }) .filter((p) => !!p) ?? []) as IContextProvider[]; @@ -296,7 +297,7 @@ export async function loadContinueConfigFromYaml( uniqueId: string, writeLog: (log: string) => Promise, workOsAccessToken: string | undefined, - overrideConfigYaml: ConfigYaml | undefined, + overrideConfigYaml: AssistantUnrolled | undefined, platformConfigMetadata: PlatformConfigMetadata | undefined, controlPlaneClient: ControlPlaneClient, ): Promise> { diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index 044006882..6200bc8de 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -1,10 +1,10 @@ import { ConfigJson } from "@continuedev/config-types"; -import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js"; import fetch, { RequestInit, Response } from "node-fetch"; import { IdeSettings, ModelDescription } from "../index.js"; import { + AssistantUnrolled, ConfigResult, FQSN, FullSlug, @@ -109,7 +109,7 @@ export class ControlPlaneClient { public async listAssistants(): Promise< { - configResult: ConfigResult; + configResult: ConfigResult; ownerSlug: string; packageSlug: string; iconUrl: string; diff --git a/core/package-lock.json b/core/package-lock.json index ec82ab0cd..2d0104353 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -13,7 +13,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.17", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -3038,9 +3038,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.16.tgz", - "integrity": "sha512-r3dzTvL8aQ5RrzM+FX6fF+U12/crU4wpPXgDcDloSsxiOQfu3k/shLCbNzFPW57XhLUQAmUJYSZsJbIvYrNPNA==", + "version": "1.0.17", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.17.tgz", + "integrity": "sha512-T1XwVuLdz0WypBt/0jUM9FKVi3VixrI/IcMzU/ErihFQ9RXMXAlH1kMdyerWb4df8/8/V2vK7G0RS/AoVarmIg==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/core/package.json b/core/package.json index 477290c9b..0d3308597 100644 --- a/core/package.json +++ b/core/package.json @@ -46,7 +46,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.17", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/gui/package-lock.json b/gui/package-lock.json index 922ac8e10..d744bf47b 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -7,7 +7,7 @@ "name": "gui", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-yaml": "^1.0.15", + "@continuedev/config-yaml": "^1.0.17", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", @@ -108,7 +108,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.17", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -556,9 +556,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.15", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.15.tgz", - "integrity": "sha512-00c1pz+FqAVEWLo8t71OJzm1KBAAJCXqIjd917Vy8lr7xO0Eoj42lo2GFlVRnqQ0hQvhFQ0s9onHhRag/phHZA==", + "version": "1.0.17", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.17.tgz", + "integrity": "sha512-T1XwVuLdz0WypBt/0jUM9FKVi3VixrI/IcMzU/ErihFQ9RXMXAlH1kMdyerWb4df8/8/V2vK7G0RS/AoVarmIg==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/gui/package.json b/gui/package.json index 5bed963dd..bb2d00315 100644 --- a/gui/package.json +++ b/gui/package.json @@ -15,7 +15,7 @@ "test:watch": "vitest" }, "dependencies": { - "@continuedev/config-yaml": "^1.0.15", + "@continuedev/config-yaml": "^1.0.17", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index 85474ad17..e05447dea 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.16", + "version": "1.0.17", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", From b3628ec9125a38aefa2784a8b4d67efe2547c92d Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 26 Jan 2025 21:24:00 -0800 Subject: [PATCH 34/57] rename AssistantRolled back to ConfigYaml --- core/package-lock.json | 8 +++--- core/package.json | 2 +- gui/package-lock.json | 10 ++++---- gui/package.json | 2 +- packages/config-yaml/package.json | 2 +- packages/config-yaml/src/converter.ts | 20 ++++++--------- packages/config-yaml/src/load/merge.ts | 8 +++--- packages/config-yaml/src/load/unroll.ts | 31 ++++++++++++----------- packages/config-yaml/src/schemas/index.ts | 4 +-- packages/config-yaml/src/validation.ts | 6 ++--- 10 files changed, 45 insertions(+), 48 deletions(-) diff --git a/core/package-lock.json b/core/package-lock.json index 2d0104353..942ca3669 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -13,7 +13,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.17", + "@continuedev/config-yaml": "^1.0.18", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -3038,9 +3038,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.17", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.17.tgz", - "integrity": "sha512-T1XwVuLdz0WypBt/0jUM9FKVi3VixrI/IcMzU/ErihFQ9RXMXAlH1kMdyerWb4df8/8/V2vK7G0RS/AoVarmIg==", + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.18.tgz", + "integrity": "sha512-Un7ngLG+8pVWsnAQHBvtTK0Efc5rRCDCI7UhhpS20yCWjmo8yZzcLd3N4yb06DtdRJs2jqo9pSKxnt8ORL4l0Q==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/core/package.json b/core/package.json index 0d3308597..bb20daed0 100644 --- a/core/package.json +++ b/core/package.json @@ -46,7 +46,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.17", + "@continuedev/config-yaml": "^1.0.18", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/gui/package-lock.json b/gui/package-lock.json index d744bf47b..f2bb629f0 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -7,7 +7,7 @@ "name": "gui", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-yaml": "^1.0.17", + "@continuedev/config-yaml": "^1.0.18", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", @@ -108,7 +108,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.17", + "@continuedev/config-yaml": "^1.0.18", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -556,9 +556,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.17", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.17.tgz", - "integrity": "sha512-T1XwVuLdz0WypBt/0jUM9FKVi3VixrI/IcMzU/ErihFQ9RXMXAlH1kMdyerWb4df8/8/V2vK7G0RS/AoVarmIg==", + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.18.tgz", + "integrity": "sha512-Un7ngLG+8pVWsnAQHBvtTK0Efc5rRCDCI7UhhpS20yCWjmo8yZzcLd3N4yb06DtdRJs2jqo9pSKxnt8ORL4l0Q==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/gui/package.json b/gui/package.json index bb2d00315..e5a18fc1e 100644 --- a/gui/package.json +++ b/gui/package.json @@ -15,7 +15,7 @@ "test:watch": "vitest" }, "dependencies": { - "@continuedev/config-yaml": "^1.0.17", + "@continuedev/config-yaml": "^1.0.18", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index e05447dea..e95995343 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.17", + "version": "1.0.19", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/converter.ts b/packages/config-yaml/src/converter.ts index a8bc6c3ff..56d5326d2 100644 --- a/packages/config-yaml/src/converter.ts +++ b/packages/config-yaml/src/converter.ts @@ -1,10 +1,10 @@ import { ConfigJson } from "@continuedev/config-types"; -import { AssistantRolled } from "./schemas/index.js"; +import { ConfigYaml } from "./schemas/index.js"; import { ModelRoles } from "./schemas/models.js"; -type ModelYaml = NonNullable[number]; -type ContextYaml = NonNullable[number]; -type PromptYaml = NonNullable[number]; +type ModelYaml = NonNullable[number]; +type ContextYaml = NonNullable[number]; +type PromptYaml = NonNullable[number]; function convertModel( m: ConfigJson["models"][number], @@ -68,9 +68,7 @@ function convertCustomCommand( }; } -function convertMcp( - mcp: any, -): NonNullable[number] { +function convertMcp(mcp: any): NonNullable[number] { const { transport } = mcp; const { command, args, env } = transport; @@ -84,7 +82,7 @@ function convertMcp( function convertDoc( doc: NonNullable[number], -): NonNullable[number] { +): NonNullable[number] { return { name: doc.title, startUrl: doc.startUrl, @@ -93,9 +91,7 @@ function convertDoc( }; } -export function convertJsonToYamlConfig( - configJson: ConfigJson, -): AssistantRolled { +export function convertJsonToYamlConfig(configJson: ConfigJson): ConfigYaml { // models const models = configJson.models.map((m) => convertModel(m, ["chat"])); const autocompleteModels = Array.isArray(configJson.tabAutocompleteModel) @@ -130,7 +126,7 @@ export function convertJsonToYamlConfig( // docs const docs = configJson.docs?.map(convertDoc); - const configYaml: AssistantRolled = { + const configYaml: ConfigYaml = { name: "Continue Config", version: "0.0.1", models, diff --git a/packages/config-yaml/src/load/merge.ts b/packages/config-yaml/src/load/merge.ts index d808f8c92..590572edb 100644 --- a/packages/config-yaml/src/load/merge.ts +++ b/packages/config-yaml/src/load/merge.ts @@ -1,9 +1,9 @@ -import { AssistantRolled } from "../schemas/index.js"; +import { ConfigYaml } from "../schemas/index.js"; export function mergePackages( - current: AssistantRolled, - incoming: AssistantRolled, -): AssistantRolled { + current: ConfigYaml, + incoming: ConfigYaml, +): ConfigYaml { return { ...current, models: [...(current.models ?? []), ...(incoming.models ?? [])], diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index a330ebe04..12a808b8b 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -7,18 +7,18 @@ import { PackageSlug, } from "../interfaces/slugs.js"; import { - AssistantRolled, - assistantRolledSchema, AssistantUnrolled, assistantUnrolledSchema, Block, blockSchema, + ConfigYaml, + configYamlSchema, } from "../schemas/index.js"; -export function parseAssistantRolled(configYaml: string): AssistantRolled { +export function parseConfigYaml(configYaml: string): ConfigYaml { try { const parsed = YAML.parse(configYaml); - const result = assistantRolledSchema.parse(parsed); + const result = configYamlSchema.parse(parsed); return result; } catch (e: any) { console.log(configYaml); @@ -123,9 +123,6 @@ function extractFQSNMap( return secretToFQSNMap(secrets, parentPackages); } -/** - * Loading an assistant is equivalent to loading a package without params - */ export async function unrollAssistant( fullSlug: string, registry: Registry, @@ -134,25 +131,32 @@ export async function unrollAssistant( // Request the content from the registry const rawContent = await registry.getContent(assistantSlug); + return unrollAssistantFromContent(assistantSlug, rawContent, registry); +} +export async function unrollAssistantFromContent( + assistantSlug: FullSlug, + rawYaml: string, + registry: Registry, +): Promise { // Convert the raw YAML to unrolled config const templateData: TemplateData = { // no inputs to an assistant inputs: {}, // at this stage, secrets are mapped to a (still templated) FQSN - secrets: extractFQSNMap(rawContent, [assistantSlug]), + secrets: extractFQSNMap(rawYaml, [assistantSlug]), // Built-in variables continue: {}, }; // Render the template const templatedYaml = fillTemplateVariables( - rawContent, + rawYaml, flattenTemplateData(templateData), ); // Parse string to Zod-validated YAML - let parsedYaml = parseAssistantRolled(templatedYaml); + let parsedYaml = parseConfigYaml(templatedYaml); // Unroll blocks const unrolledAssistant = await unrollBlocks( @@ -165,7 +169,7 @@ export async function unrollAssistant( } export async function unrollBlocks( - assistant: AssistantRolled, + assistant: ConfigYaml, assistantFullSlug: FullSlug, registry: Registry, ): Promise { @@ -174,10 +178,7 @@ export async function unrollBlocks( version: assistant.version, }; - const sections: (keyof Omit< - AssistantRolled, - "name" | "version" | "rules" - >)[] = [ + const sections: (keyof Omit)[] = [ "models", "context", "data", diff --git a/packages/config-yaml/src/schemas/index.ts b/packages/config-yaml/src/schemas/index.ts index 3d0c34bc3..557e40b28 100644 --- a/packages/config-yaml/src/schemas/index.ts +++ b/packages/config-yaml/src/schemas/index.ts @@ -48,7 +48,7 @@ export const blockItemWrapperSchema = (schema: T) => export const blockOrSchema = (schema: T) => z.union([schema, blockItemWrapperSchema(schema)]); -export const assistantRolledSchema = z.object({ +export const configYamlSchema = z.object({ name: z.string(), version: z.string(), models: z @@ -82,7 +82,7 @@ export const assistantRolledSchema = z.object({ docs: z.array(blockOrSchema(docSchema)).optional(), }); -export type AssistantRolled = z.infer; +export type ConfigYaml = z.infer; export const assistantUnrolledSchema = z.object({ name: z.string(), diff --git a/packages/config-yaml/src/validation.ts b/packages/config-yaml/src/validation.ts index 1fb145ee1..766f852bd 100644 --- a/packages/config-yaml/src/validation.ts +++ b/packages/config-yaml/src/validation.ts @@ -1,4 +1,4 @@ -import { AssistantRolled, assistantRolledSchema } from "./schemas/index.js"; +import { ConfigYaml, configYamlSchema } from "./schemas/index.js"; export interface ConfigValidationError { fatal: boolean; @@ -12,12 +12,12 @@ export interface ConfigResult { } export function validateConfigYaml( - config: AssistantRolled, + config: ConfigYaml, ): ConfigValidationError[] { const errors: ConfigValidationError[] = []; try { - assistantRolledSchema.parse(config); + configYamlSchema.parse(config); } catch (e: any) { return [ { From b06b05d9372848db3bc0c4badf7ffe896a2fcd2e Mon Sep 17 00:00:00 2001 From: Stefan Buys <22056509+StefanB7@users.noreply.github.com> Date: Mon, 27 Jan 2025 08:01:26 +0200 Subject: [PATCH 35/57] Specify api base for ollama Specifies the ollama api base, as some run ollama on a different machine than their localhost, making it easy for them to see where to change the api base. --- docs/docs/chat/model-setup.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/docs/chat/model-setup.mdx b/docs/docs/chat/model-setup.mdx index eb7dc5430..e7e6ca94a 100644 --- a/docs/docs/chat/model-setup.mdx +++ b/docs/docs/chat/model-setup.mdx @@ -129,7 +129,8 @@ If your local machine can run an 8B parameter model, then we recommend running L { "title": "Llama 3.1 8B", "provider": "ollama", - "model": "llama3.1:8b" + "model": "llama3.1:8b", + "apiBase": "http://localhost:11434" } ] ``` @@ -158,7 +159,8 @@ If your local machine can run a 16B parameter model, then we recommend running D { "title": "DeepSeek Coder 2 16B", "provider": "ollama", - "model": "deepseek-coder-v2:16b" + "model": "deepseek-coder-v2:16b", + "apiBase": "http://localhost:11434" } ] ``` From aa4a72996b2ffc99d40a2d0e78889c2e8e1ceac6 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 26 Jan 2025 22:33:41 -0800 Subject: [PATCH 36/57] getBlockType --- core/package-lock.json | 8 ++--- core/package.json | 2 +- gui/package-lock.json | 10 +++--- gui/package.json | 2 +- packages/config-yaml/package.json | 2 +- packages/config-yaml/src/index.ts | 1 + packages/config-yaml/src/load/getBlockType.ts | 32 +++++++++++++++++++ 7 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 packages/config-yaml/src/load/getBlockType.ts diff --git a/core/package-lock.json b/core/package-lock.json index 942ca3669..9562aea17 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -13,7 +13,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.18", + "@continuedev/config-yaml": "^1.0.20", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -3038,9 +3038,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.18", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.18.tgz", - "integrity": "sha512-Un7ngLG+8pVWsnAQHBvtTK0Efc5rRCDCI7UhhpS20yCWjmo8yZzcLd3N4yb06DtdRJs2jqo9pSKxnt8ORL4l0Q==", + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.20.tgz", + "integrity": "sha512-MMCqE5khk5MnQc4udPOGCuXf8q+Zo01D4n4qbZu4oPV1foXHfQIZwQkWaQLJOJzzODZEBpgeJeJCknweYckgWg==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/core/package.json b/core/package.json index bb20daed0..05beaca5c 100644 --- a/core/package.json +++ b/core/package.json @@ -46,7 +46,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.18", + "@continuedev/config-yaml": "^1.0.20", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/gui/package-lock.json b/gui/package-lock.json index f2bb629f0..50061f21e 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -7,7 +7,7 @@ "name": "gui", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-yaml": "^1.0.18", + "@continuedev/config-yaml": "^1.0.20", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", @@ -108,7 +108,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.18", + "@continuedev/config-yaml": "^1.0.20", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -556,9 +556,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.18", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.18.tgz", - "integrity": "sha512-Un7ngLG+8pVWsnAQHBvtTK0Efc5rRCDCI7UhhpS20yCWjmo8yZzcLd3N4yb06DtdRJs2jqo9pSKxnt8ORL4l0Q==", + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.20.tgz", + "integrity": "sha512-MMCqE5khk5MnQc4udPOGCuXf8q+Zo01D4n4qbZu4oPV1foXHfQIZwQkWaQLJOJzzODZEBpgeJeJCknweYckgWg==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/gui/package.json b/gui/package.json index e5a18fc1e..cf5cbd0fa 100644 --- a/gui/package.json +++ b/gui/package.json @@ -15,7 +15,7 @@ "test:watch": "vitest" }, "dependencies": { - "@continuedev/config-yaml": "^1.0.18", + "@continuedev/config-yaml": "^1.0.20", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index e95995343..e9d11ad03 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.19", + "version": "1.0.22", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/index.ts b/packages/config-yaml/src/index.ts index 9ebf6cb32..0fcd5ae10 100644 --- a/packages/config-yaml/src/index.ts +++ b/packages/config-yaml/src/index.ts @@ -3,6 +3,7 @@ export * from "./interfaces/index.js"; export * from "./interfaces/SecretResult.js"; export * from "./interfaces/slugs.js"; export * from "./load/clientRender.js"; +export * from "./load/getBlockType.js"; export * from "./load/merge.js"; export * from "./load/proxySecretResolution.js"; export * from "./load/unroll.js"; diff --git a/packages/config-yaml/src/load/getBlockType.ts b/packages/config-yaml/src/load/getBlockType.ts new file mode 100644 index 000000000..680c3b644 --- /dev/null +++ b/packages/config-yaml/src/load/getBlockType.ts @@ -0,0 +1,32 @@ +import { ConfigYaml } from "../schemas/index.js"; + +export type BlockType = + | "models" + | "context" + | "docs" + | "tools" + | "mcpServers" + | "data" + | "rules" + | "prompts"; +export function getBlockType(block: ConfigYaml): BlockType { + if (block.context?.length) { + return "context"; + } else if (block.models?.length) { + return "models"; + } else if (block.docs?.length) { + return "docs"; + } else if (block.tools?.length) { + return "tools"; + } else if (block.mcpServers?.length) { + return "mcpServers"; + } else if (block.data?.length) { + return "data"; + } else if (block.rules?.length) { + return "rules"; + } else if (block.prompts?.length) { + return "prompts"; + } else { + throw new Error("Unknown block type"); + } +} From 015ed6d88c9248eede8808d65704ccf12152671c Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 27 Jan 2025 12:17:55 -0800 Subject: [PATCH 37/57] fix contentToShow logic in logger --- core/llm/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/llm/index.ts b/core/llm/index.ts index 70565b5ee..da1825407 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -460,9 +460,11 @@ export abstract class BaseLLM implements ILLM { `${toolCall.function?.name}(${toolCall.function?.arguments})`, ) .join("\n"); - } else if ("content" in msg && Array.isArray(msg.content)) { - const content = renderChatMessage(msg); - msg.content = content; + } else if ("content" in msg) { + if (Array.isArray(msg.content)) { + msg.content = renderChatMessage(msg); + } + contentToShow = msg.content; } formatted += `<${msg.role}>\n${contentToShow}\n\n`; From d7878663ea871ccfe9407cc080150100690fbed1 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 27 Jan 2025 12:30:38 -0800 Subject: [PATCH 38/57] make long model list scroll in model select --- gui/src/components/modelSelection/ModelSelect.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 63d097370..68f5ea996 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -332,7 +332,9 @@ function ModelSelect() { $showabove={showAbove} className="z-50 max-w-[90vw]" > -
+
{sortedOptions.map((option, idx) => (
+ + {selectedProfileId === "local" && ( <> Date: Mon, 27 Jan 2025 13:17:36 -0800 Subject: [PATCH 39/57] loading submenu item --- gui/src/components/mainInput/MentionList.tsx | 170 +++++++++++-------- 1 file changed, 96 insertions(+), 74 deletions(-) diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index 530144e4a..323b586d0 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -155,7 +155,6 @@ const ItemDiv = styled.div` text-align: left; width: 100%; color: ${vscForeground}; - cursor: pointer; &.is-selected { background-color: ${vscListActiveBackground}; @@ -203,6 +202,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { const [querySubmenuItem, setQuerySubmenuItem] = useState< ComboBoxItem | undefined >(undefined); + const [loadingSubmenuItem, setLoadingSubmenuItem] = useState< + ComboBoxItem | undefined + >(undefined); const [allItems, setAllItems] = useState([]); @@ -245,8 +247,8 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { description: "Create a new .prompt file", }); } - - setAllItems(items); + setLoadingSubmenuItem(items.find((item) => item.id === "loading")); + setAllItems(items.filter((item) => item.id !== "loading")); }, [subMenuTitle, props.items, props.editor]); const queryInputRef = useRef(null); @@ -403,78 +405,98 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { ) : ( <> {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)} - data-testid="context-provider-dropdown-item" - > - -
- {showFileIconForItem(item) && ( - - )} - {!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} - > - - - ); - })} - + {loadingSubmenuItem && ( + + +
+ + {loadingSubmenuItem.title} + {" "} +
+ + {loadingSubmenuItem.description} -
- )) +
+
+ )} + {allItems.length ? ( + allItems.map((item, index) => { + const isSelected = index === selectedIndex; + return ( + (itemRefs.current[index] = el)} + className={`item cursor-pointer ${isSelected ? "is-selected" : ""}`} + key={index} + onClick={() => selectItem(index)} + onMouseEnter={() => setSelectedIndex(index)} + data-testid="context-provider-dropdown-item" + > + +
+ {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 )} From e8576a594d6bce1f906f8ae4a8b19a3e0c05fccf Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Mon, 27 Jan 2025 22:23:39 +0000 Subject: [PATCH 40/57] document defaults and missing config flag --- .../docs/customize/deep-dives/autocomplete.md | 19 ++++++++++--------- docs/docs/reference.md | 18 +++++++++--------- .../current/reference.md | 18 +++++++++--------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/docs/docs/customize/deep-dives/autocomplete.md b/docs/docs/customize/deep-dives/autocomplete.md index 221a6d49f..13b86c51d 100644 --- a/docs/docs/customize/deep-dives/autocomplete.md +++ b/docs/docs/customize/deep-dives/autocomplete.md @@ -58,16 +58,17 @@ This is just another object like the ones in the `"models"` array of `config.jso This object allows you to customize the behavior of tab-autocomplete. The available options are shown below, and you can find their default values [here](https://github.com/continuedev/continue/blob/fbeb2e4fe15d4b434a30a136f74b672485c852d9/core/util/parameters.ts). -- `disable`: Disable autocomplete (can also be done from IDE settings) +- `disable`: Disable autocomplete (can also be done from IDE settings) (default: `false`) - `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) -- `debounceDelay`: The delay in milliseconds before triggering autocomplete after a keystroke. (Number) -- `multilineCompletions`: Whether to enable multiline completions ("always", "never", or "auto"). Defaults to "auto". -- `useCache`: Whether to cache and reuse completions when the prompt is the same as a previous one. May be useful to disable for testing purposes. -- `disableInFiles`: A list of glob patterns for files in which you want to disable tab autocomplete. +- `useFileSuffix`: Determines whether to use the file suffix in the prompt. (Boolean) (default: `true`) +- `maxPromptTokens`: The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number) (default: `1024`) +- `prefixPercentage`: The percentage of the input that should be dedicated to the prefix. (Number) (default: `0.3`) +- `maxSuffixPercentage`: The maximum percentage of the prompt that can be dedicated to the suffix. (Number) (default: `0.2`) +- `debounceDelay`: The delay in milliseconds before triggering autocomplete after a keystroke. (Number) (default: `350`) +- `multilineCompletions`: Whether to enable multiline completions ("always", "never", or "auto"). Defaults to "auto". (default: `auto`) +- `useCache`: Whether to cache and reuse completions when the prompt is the same as a previous one. May be useful to disable for testing purposes. (default: `true`) +- `disableInFiles`: A list of glob patterns for files in which you want to disable tab autocomplete. (default: `[]`) +- `onlyMyCode`: If `true`, only includes code within the repository (default: `true`). ### Full example diff --git a/docs/docs/reference.md b/docs/docs/reference.md index 8e2265d59..809d4d1c4 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -83,16 +83,16 @@ 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. -- `prefixPercentage`: Percentage of input for prefix. +- `useFileSuffix`: If `true`, includes file suffix in the prompt (default: `true`). +- `maxPromptTokens`: Maximum number of tokens for the prompt (default: `1024`). +- `debounceDelay`: Delay (in ms) before triggering autocomplete (default: `350`). +- `maxSuffixPercentage`: Maximum percentage of prompt for suffix (default: `0.2`). +- `prefixPercentage`: Percentage of input for prefix (default: `0.3`). - `template`: Template string for autocomplete, using Mustache templating. You can use the `{{{ prefix }}}`, `{{{ suffix }}}`, `{{{ filename }}}`, `{{{ reponame }}}`, and `{{{ language }}}` variables. -- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`). -- `useCache`: If `true`, caches completions. -- `onlyMyCode`: If `true`, only includes code within the repository. -- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled. +- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`) (default: `auto`). +- `useCache`: If `true`, caches completions (default: `true`). +- `onlyMyCode`: If `true`, only includes code within the repository (default: `true`). +- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled (default: `[]`). Example 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..86a998b5b 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,16 +83,16 @@ 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. -- `prefixPercentage`: Percentage of input for prefix. +- `useFileSuffix`: If `true`, includes file suffix in the prompt (default: `true`). +- `maxPromptTokens`: Maximum number of tokens for the prompt (default: `1024`). +- `debounceDelay`: Delay (in ms) before triggering autocomplete (default: `350`). +- `maxSuffixPercentage`: Maximum percentage of prompt for suffix (default: `0.2`). +- `prefixPercentage`: Percentage of input for prefix (default: `0.3`). - `template`: Template string for autocomplete, using Mustache templating. -- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`). -- `useCache`: If `true`, caches completions. -- `onlyMyCode`: If `true`, only includes code within the repository. -- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled. +- `multilineCompletions`: Controls multiline completions (`"always"`, `"never"`, or `"auto"`) (default: `auto`). +- `useCache`: If `true`, caches completions (default: `true`). +- `onlyMyCode`: If `true`, only includes code within the repository (default: `true`). +- `disableInFiles`: Array of glob patterns for files where autocomplete is disabled (default: `[]`). Example From 4ba2aefffeae96f6ffabfd5d4ecc5fc3796f6e58 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 27 Jan 2025 14:56:13 -0800 Subject: [PATCH 41/57] submenu-updates --- gui/src/context/SubmenuContextProviders.tsx | 184 +++++++++++--------- 1 file changed, 104 insertions(+), 80 deletions(-) diff --git a/gui/src/context/SubmenuContextProviders.tsx b/gui/src/context/SubmenuContextProviders.tsx index e5bb876a3..5b6e58fa4 100644 --- a/gui/src/context/SubmenuContextProviders.tsx +++ b/gui/src/context/SubmenuContextProviders.tsx @@ -116,7 +116,10 @@ export const SubmenuContextProvidersProvider = ({ }; }, [ideMessenger]); - const providersLoading = useRef(new Set()).current; + const providersLoading = useRef(new Set()).current; + const abortControllers = useRef( + new Map(), + ).current; const getSubmenuContextItems = useCallback( ( @@ -217,94 +220,116 @@ export const SubmenuContextProvidersProvider = ({ ); const loadSubmenuItems = useCallback( - (providers: "dependsOnIndexing" | "all" | ContextProviderName[]) => { - submenuContextProviders.forEach( - async (description: ContextProviderDescription) => { - try { - if (providersLoading.has(description.title)) { - return; - } - providersLoading.add(description.title); + async (providers: "dependsOnIndexing" | "all" | ContextProviderName[]) => { + await Promise.allSettled( + submenuContextProviders.map( + async (description: ContextProviderDescription) => { + const controller = new AbortController(); + try { + const refreshProvider = + providers === "all" + ? true + : providers === "dependsOnIndexing" + ? description.dependsOnIndexing + : providers.includes(description.title); - const refreshProvider = - providers === "all" - ? true - : providers === "dependsOnIndexing" - ? description.dependsOnIndexing - : providers.includes(description.title); + if (!refreshProvider) { + if (providers === "dependsOnIndexing") { + console.debug( + `Skipping ${description.title} provider due to disabled indexing`, + ); + } + return; + } - if (!refreshProvider) { - return; - } - - if (description.dependsOnIndexing && disableIndexing) { - console.debug( - `Skipping ${description.title} provider due to disabled indexing`, + // Submenu loading requests cancel existing requests + abortControllers.get(description.title)?.abort(); + abortControllers.set(description.title, controller); + providersLoading.add(description.title); + console.log( + `Refreshing items for ${description.title} submenu provider`, + ); + const result = await ideMessenger.request( + "context/loadSubmenuItems", + { + title: description.title, + }, ); - return; - } - const result = await ideMessenger.request( - "context/loadSubmenuItems", - { - title: description.title, - }, - ); - if (result.status === "error") { - throw new Error(result.error); - } - const submenuItems = result.content; - const providerTitle = description.title; + // IMPORTANT - the controller only prevents invalid loading state + // But does not cancel using data from the request + // Could uncomment this to truly cancel the request + // if (controller.signal.aborted) { + // return console.debug( + // `${description.title} provider loading aborted`, + // ); + // } - const itemsWithProvider = submenuItems.map((item) => ({ - ...item, - providerTitle, - })); + if (result.status === "error") { + throw new Error(result.error); + } + const submenuItems = result.content; + const providerTitle = description.title; - const minisearch = new MiniSearch({ - fields: ["title", "description"], - storeFields: ["id", "title", "description", "providerTitle"], - }); - - minisearch.addAll( - submenuItems.map((item) => ({ ...item, providerTitle })), - ); - - setMinisearches((prev) => ({ - ...prev, - [providerTitle]: minisearch, - })); - - if (providerTitle === "file") { - setFallbackResults((prev) => ({ - ...prev, - file: deduplicateArray( - [...lastOpenFilesRef.current, ...(prev.file ?? [])], - (a, b) => a.id === b.id, - ), + const itemsWithProvider = submenuItems.map((item) => ({ + ...item, + providerTitle, })); - } else { - setFallbackResults((prev) => ({ + + const minisearch = new MiniSearch( + { + fields: ["title", "description"], + storeFields: ["id", "title", "description", "providerTitle"], + }, + ); + + minisearch.addAll( + submenuItems.map((item) => ({ ...item, providerTitle })), + ); + + setMinisearches((prev) => ({ ...prev, - [providerTitle]: itemsWithProvider, + [providerTitle]: minisearch, })); + + if (providerTitle === "file") { + setFallbackResults((prev) => ({ + ...prev, + file: deduplicateArray( + [...lastOpenFilesRef.current, ...(prev.file ?? [])], + (a, b) => a.id === b.id, + ), + })); + } else { + setFallbackResults((prev) => ({ + ...prev, + [providerTitle]: itemsWithProvider, + })); + } + } catch (error) { + console.error( + `Error loading items for ${description.title}:`, + error, + ); + console.error( + "Error details:", + JSON.stringify(error, Object.getOwnPropertyNames(error)), + ); + } finally { + if (!controller.signal.aborted) { + providersLoading.delete(description.title); + } } - } catch (error) { - console.error( - `Error loading items for ${description.title}:`, - error, - ); - console.error( - "Error details:", - JSON.stringify(error, Object.getOwnPropertyNames(error)), - ); - } finally { - providersLoading.delete(description.title); - } - }, + }, + ), ); }, - [submenuContextProviders, disableIndexing, providersLoading], + [ + submenuContextProviders, + disableIndexing, + providersLoading, + abortControllers, + ], ); useWebviewListener( @@ -318,14 +343,13 @@ export const SubmenuContextProvidersProvider = ({ // Reload all submenu items on the initial config load // TODO - could refresh on any change const initialLoad = useRef(false); - const config = useAppSelector((store) => store.config.config); useEffect(() => { - if (!config?.contextProviders?.length || initialLoad.current) { + if (!submenuContextProviders.length || initialLoad.current) { return; } void loadSubmenuItems("all"); initialLoad.current = true; - }, [loadSubmenuItems, config, initialLoad]); + }, [loadSubmenuItems, submenuContextProviders, initialLoad]); return ( Date: Mon, 27 Jan 2025 17:35:15 -0800 Subject: [PATCH 42/57] add content level --- .../continue/IdeProtocolClient.kt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 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 0a0b6b83a..bd6bbd5fb 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 @@ -54,6 +54,16 @@ class IdeProtocolClient( val messageType = message.messageType val dataElement = message.data + // A couple oddball messages respond directly to GUI, expect a different message format + // e.g. jetbrains/isOSREnabled + fun respondToWebview(content: Any) { + respond(mutableMapOf( + "done" to true, + "status" to "success", + "content" to content + )) + } + try { when (messageType) { "showTutorial" -> { @@ -63,12 +73,12 @@ class IdeProtocolClient( "jetbrains/isOSREnabled" -> { val isOSREnabled = ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR - respond(isOSREnabled) + respondToWebview(isOSREnabled) } "jetbrains/getColors" -> { val colors = GetTheme().getTheme(); - respond(colors) + respondToWebview(colors) } "jetbrains/onLoad" -> { @@ -78,7 +88,7 @@ class IdeProtocolClient( "vscMachineId" to getMachineUniqueID(), "vscMediaUrl" to "http://continue", ) - respond(jsonData) + respondToWebview(jsonData) } "getIdeSettings" -> { From 4baca3d4ecababa319fa04e25be31cf7ae0f6fd7 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 27 Jan 2025 20:44:44 -0800 Subject: [PATCH 43/57] free trial fixes --- core/package-lock.json | 8 +++--- core/package.json | 2 +- extensions/vscode/package-lock.json | 6 ++--- gui/package-lock.json | 10 +++---- gui/package.json | 2 +- packages/config-yaml/package.json | 2 +- .../src/interfaces/SecretResult.ts | 27 +++++++++++++++++-- packages/config-yaml/src/interfaces/index.ts | 6 ++++- packages/config-yaml/src/load/clientRender.ts | 8 ------ 9 files changed, 45 insertions(+), 26 deletions(-) diff --git a/core/package-lock.json b/core/package-lock.json index 9562aea17..7edab380e 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -13,7 +13,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.20", + "@continuedev/config-yaml": "^1.0.23", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -3038,9 +3038,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.20", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.20.tgz", - "integrity": "sha512-MMCqE5khk5MnQc4udPOGCuXf8q+Zo01D4n4qbZu4oPV1foXHfQIZwQkWaQLJOJzzODZEBpgeJeJCknweYckgWg==", + "version": "1.0.23", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.23.tgz", + "integrity": "sha512-F2Hwc85iCwAHJuwJALOsmZIBeHdF+87mS0YT7dlC6QiE+zAhZKUHcLQ/nTt9bJuhyVyufpb9LApkp40UdGsaWw==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/core/package.json b/core/package.json index 05beaca5c..111fbe902 100644 --- a/core/package.json +++ b/core/package.json @@ -46,7 +46,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.20", + "@continuedev/config-yaml": "^1.0.23", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 38d0db7c8..cbc67ea38 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.255", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.254", + "version": "0.9.255", "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.20", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/gui/package-lock.json b/gui/package-lock.json index 50061f21e..cca979250 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -7,7 +7,7 @@ "name": "gui", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-yaml": "^1.0.20", + "@continuedev/config-yaml": "^1.0.23", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", @@ -108,7 +108,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.20", + "@continuedev/config-yaml": "^1.0.23", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", @@ -556,9 +556,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.0.20", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.20.tgz", - "integrity": "sha512-MMCqE5khk5MnQc4udPOGCuXf8q+Zo01D4n4qbZu4oPV1foXHfQIZwQkWaQLJOJzzODZEBpgeJeJCknweYckgWg==", + "version": "1.0.23", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.23.tgz", + "integrity": "sha512-F2Hwc85iCwAHJuwJALOsmZIBeHdF+87mS0YT7dlC6QiE+zAhZKUHcLQ/nTt9bJuhyVyufpb9LApkp40UdGsaWw==", "dependencies": { "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", diff --git a/gui/package.json b/gui/package.json index cf5cbd0fa..4500287fa 100644 --- a/gui/package.json +++ b/gui/package.json @@ -15,7 +15,7 @@ "test:watch": "vitest" }, "dependencies": { - "@continuedev/config-yaml": "^1.0.20", + "@continuedev/config-yaml": "^1.0.23", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@reduxjs/toolkit": "^2.3.0", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index e9d11ad03..c3c5419a9 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.22", + "version": "1.0.23", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/interfaces/SecretResult.ts b/packages/config-yaml/src/interfaces/SecretResult.ts index 987b33676..b15940d6e 100644 --- a/packages/config-yaml/src/interfaces/SecretResult.ts +++ b/packages/config-yaml/src/interfaces/SecretResult.ts @@ -4,6 +4,7 @@ export enum SecretType { User = "user", Package = "package", Organization = "organization", + NotFound = "not_found", } export interface OrgSecretLocation { @@ -24,18 +25,34 @@ export interface UserSecretLocation { secretName: string; } +/** + * If not found in user/package/org secrets, then there's a chance it's in + * - the on-prem proxy + * - models add-on + * - free trial + */ +export interface NotFoundSecretLocation { + secretType: SecretType.NotFound; + secretName: string; +} + export type SecretLocation = | OrgSecretLocation | PackageSecretLocation - | UserSecretLocation; + | UserSecretLocation + | NotFoundSecretLocation; export function encodeSecretLocation(secretLocation: SecretLocation): string { if (secretLocation.secretType === SecretType.Organization) { return `${SecretType.Organization}:${secretLocation.orgSlug}/${secretLocation.secretName}`; } else if (secretLocation.secretType === SecretType.User) { return `${SecretType.User}:${secretLocation.userSlug}/${secretLocation.secretName}`; - } else { + } else if (secretLocation.secretType === SecretType.Package) { return `${SecretType.Package}:${encodePackageSlug(secretLocation.packageSlug)}/${secretLocation.secretName}`; + } else if (secretLocation.secretType === SecretType.NotFound) { + return `${SecretType.NotFound}:${secretLocation.secretName}`; + } else { + throw new Error(`Invalid secret type: ${secretLocation}`); } } @@ -63,6 +80,11 @@ export function decodeSecretLocation(secretLocation: string): SecretLocation { packageSlug: { ownerSlug: parts[0], packageSlug: parts[1] }, secretName, }; + case SecretType.NotFound: + return { + secretType: SecretType.NotFound, + secretName, + }; default: throw new Error(`Invalid secret type: ${secretType}`); } @@ -70,6 +92,7 @@ export function decodeSecretLocation(secretLocation: string): SecretLocation { export interface NotFoundSecretResult { found: false; + secretLocation: NotFoundSecretLocation; fqsn: FQSN; } diff --git a/packages/config-yaml/src/interfaces/index.ts b/packages/config-yaml/src/interfaces/index.ts index 8ad1d9c38..3bbd17d92 100644 --- a/packages/config-yaml/src/interfaces/index.ts +++ b/packages/config-yaml/src/interfaces/index.ts @@ -69,7 +69,7 @@ export async function resolveFQSN( secretLocation, value: secret, }; - } else { + } else if (secretLocation.secretType !== SecretType.NotFound) { return { found: true, fqsn, @@ -81,6 +81,10 @@ export async function resolveFQSN( return { found: false, + secretLocation: { + secretName: fqsn.secretName, + secretType: SecretType.NotFound, + }, fqsn, }; } diff --git a/packages/config-yaml/src/load/clientRender.ts b/packages/config-yaml/src/load/clientRender.ts index 75e2f89bb..63bca7e0e 100644 --- a/packages/config-yaml/src/load/clientRender.ts +++ b/packages/config-yaml/src/load/clientRender.ts @@ -45,14 +45,6 @@ export async function clientRender( continue; } - if (!secretResult.found) { - // When a secret isn't found anywhere, we keep it templated as just the secret name - // in case it can be found in the on-prem proxy's env - secretsTemplateData["secrets." + encodeFQSN(secretResult.fqsn)] = - `\${{ secrets.${secretResult.fqsn.secretName} }}`; - continue; - } - if ("value" in secretResult) { secretStore.set(secretResult.fqsn.secretName, secretResult.value); } From 3c6a49d1bc4968c3cf7deae27d9aee18b437ec9b Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 27 Jan 2025 20:49:52 -0800 Subject: [PATCH 44/57] fix link --- core/config/ConfigHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 6da94b528..edcf62071 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -111,7 +111,7 @@ export class ConfigHandler { } } else { const env = await getControlPlaneEnv(this.ide.getIdeSettings()); - await this.ide.openUrl(`${env.APP_URL}${openProfileId}`); + await this.ide.openUrl(`${env.APP_URL}platform/${openProfileId}`); } } From 69eef920cd52c11c9dc4407286ddeab784551303 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 27 Jan 2025 21:00:15 -0800 Subject: [PATCH 45/57] 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 fd5f55a70..4927a0e4a 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.255", + "version": "0.9.256", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From dc4d2bcb47f98e58a802b949df9485a0a4e1d352 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 27 Jan 2025 22:25:06 -0800 Subject: [PATCH 46/57] fix e2e tests --- extensions/vscode/e2e/test-continue-yaml/config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/vscode/e2e/test-continue-yaml/config.yaml b/extensions/vscode/e2e/test-continue-yaml/config.yaml index 487cdc8dd..5de426a94 100644 --- a/extensions/vscode/e2e/test-continue-yaml/config.yaml +++ b/extensions/vscode/e2e/test-continue-yaml/config.yaml @@ -69,8 +69,8 @@ models: - apply context: - - uses: docs - - uses: diff - - uses: url - - uses: folder - - uses: terminal + - provider: docs + - provider: diff + - provider: url + - provider: folder + - provider: terminal From fae83bac43f0e0ae028cc0f008c55c9551f158b1 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 28 Jan 2025 13:54:53 -0800 Subject: [PATCH 47/57] count tokens: handle no messages --- core/llm/countTokens.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/llm/countTokens.ts b/core/llm/countTokens.ts index 5f88c13eb..dfbd2da5d 100644 --- a/core/llm/countTokens.ts +++ b/core/llm/countTokens.ts @@ -399,10 +399,10 @@ function compileChatMessages( if ( (systemMessage && systemMessage.trim() !== "") || - msgs?.[0].role === "system" + msgs?.[0]?.role === "system" ) { let content = ""; - if (msgs?.[0].role === "system") { + if (msgs?.[0]?.role === "system") { content = renderChatMessage(msgs?.[0]); } if (systemMessage && systemMessage.trim() !== "") { From f9eeeabc98e2e5ca28b9da8a6fa70274a57d5c4a Mon Sep 17 00:00:00 2001 From: German Swan Date: Wed, 29 Jan 2025 00:07:29 +0200 Subject: [PATCH 48/57] 3832: ui improvements --- .../components/StepContainer/Reasoning.tsx | 104 ++++++++++++++---- 1 file changed, 81 insertions(+), 23 deletions(-) diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx index c817111f4..9b57dbb99 100644 --- a/gui/src/components/StepContainer/Reasoning.tsx +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -2,9 +2,15 @@ import { ChatHistoryItem } from "core"; import { stripImages } from "core/util/messageContent"; import { useEffect, useState } from "react"; import styled from "styled-components"; -import { defaultBorderRadius, lightGray, vscBackground, vscQuickInputBackground, } from ".."; +import { + defaultBorderRadius, + lightGray, + vscBackground, + vscQuickInputBackground, +} from ".."; import { getFontSize } from "../../util"; import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; +import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid"; interface ReasoningProps { item: ChatHistoryItem; @@ -13,6 +19,7 @@ interface ReasoningProps { } const SpoilerButton = styled.div` + margin: 8px 6px 16px 6px; background-color: ${vscBackground}; width: fit-content; font-size: ${getFontSize() - 2}px; @@ -33,6 +40,12 @@ const SpoilerButton = styled.div` } `; +const ButtonContent = styled.div` + display: flex; + align-items: center; + gap: 6px; +`; + const ContentDiv = styled.div<{ fontSize?: number }>` margin: 4px; padding: 4px; @@ -43,37 +56,82 @@ const ContentDiv = styled.div<{ fontSize?: number }>` background-color: ${vscQuickInputBackground}; `; +const ThinkingText = styled.span` + position: relative; + padding-right: 12px; + + &:after { + content: "..."; + position: absolute; + animation: ellipsis 1s steps(4, end) infinite; + width: 0px; + display: inline-block; + overflow: hidden; + } + + @keyframes ellipsis { + 0%, + 100% { + width: 0px; + } + 33% { + width: 8px; + } + 66% { + width: 16px; + } + 90% { + width: 24px; + } + } +`; + export default function Reasoning(props: ReasoningProps) { const [open, setOpen] = useState(false); const [reasoningTime, setReasoningTime] = useState(""); + const isThinking = !props.item.reasoning?.endAt; useEffect(() => { if (!props.item.reasoning) return; + if (!props.item.reasoning?.endAt) return; - const interval = setInterval(() => { - const startAt = props.item.reasoning?.startAt || Date.now(); - const endAt = props.item.reasoning?.endAt || Date.now(); - const diff = endAt - startAt; - const diffString = `${(diff / 1000).toFixed(1)}s`; - setReasoningTime(diffString) - }, 100); - - return () => clearInterval(interval); - }, [props.item.reasoning?.startAt, props.item.reasoning?.endAt]) + const startAt = props.item.reasoning?.startAt || Date.now(); + const endAt = props.item.reasoning?.endAt || Date.now(); + const diff = endAt - startAt; + const diffString = `${(diff / 1000).toFixed(1)}s`; + setReasoningTime(diffString); + }, [props.item.reasoning?.startAt, props.item.reasoning?.endAt]); if (!props.item.reasoning?.text) { return null; } - return <> - setOpen(!open)}> {open ? "Hide" : "Show"} reasoning: {reasoningTime} - {open && ( - - )} - -} + return ( + <> + setOpen(!open)}> + + {isThinking ? ( + Thinking + ) : ( + `Thought for ${reasoningTime}` + )} + {open ? ( + + ) : ( + + )} + + + {open && ( + + + + )} + + ); +} \ No newline at end of file From a7323afa1b0cac31d3c4c7c0812d70d8e8ccdf26 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 28 Jan 2025 14:14:57 -0800 Subject: [PATCH 49/57] add toggleDevTools ide message handleing git push --- .../continueintellijextension/continue/IdeProtocolClient.kt | 4 ++++ 1 file changed, 4 insertions(+) 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 0a0b6b83a..cdb32be52 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 @@ -56,6 +56,10 @@ class IdeProtocolClient( try { when (messageType) { + "toggleDevTools" -> { + continuePluginService.continuePluginWindow?.browser?.browser?.openDevtools() + } + "showTutorial" -> { showTutorial(project) } From 245199907fcecb6184249c923821486ab618a35d Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 29 Jan 2025 13:27:37 -0800 Subject: [PATCH 50/57] don't use enum --- extensions/vscode/package-lock.json | 6 +++--- extensions/vscode/package.json | 14 ++++---------- extensions/vscode/src/VsCodeIde.ts | 6 +++--- extensions/vscode/src/extension/VsCodeExtension.ts | 12 ++++++++---- extensions/vscode/src/stubs/WorkOsAuthProvider.ts | 8 +++----- 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index cbc67ea38..4ca866899 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.255", + "version": "0.9.256", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.255", + "version": "0.9.256", "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.20", + "@continuedev/config-yaml": "^1.0.23", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 4927a0e4a..b74dcbd5d 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -96,16 +96,10 @@ "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", - "local" - ], - "default": "none", - "description": "Continue test environment" + "continue.enableContinueHub": { + "type": "boolean", + "default": false, + "description": "Enable Continue Hub (internal)" }, "continue.showInlineTip": { "type": "boolean", diff --git a/extensions/vscode/src/VsCodeIde.ts b/extensions/vscode/src/VsCodeIde.ts index fbd2077a1..bfb67d926 100644 --- a/extensions/vscode/src/VsCodeIde.ts +++ b/extensions/vscode/src/VsCodeIde.ts @@ -636,9 +636,9 @@ class VsCodeIde implements IDE { "enableContinueForTeams", false, ), - continueTestEnvironment: settings.get< - IdeSettings["continueTestEnvironment"] - >("continueTestEnvironment", "none"), + continueTestEnvironment: settings.get("enableContinueHub") + ? "production" + : "none", pauseCodebaseIndexOnStart: settings.get( "pauseCodebaseIndexOnStart", false, diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index b49960919..be58bb375 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -1,6 +1,6 @@ import fs from "fs"; -import { IContextProvider, IdeSettings } from "core"; +import { IContextProvider } from "core"; import { ConfigHandler } from "core/config/ConfigHandler"; import { EXTENSION_NAME, getControlPlaneEnv } from "core/control-plane/env"; import { Core } from "core/core"; @@ -375,9 +375,9 @@ export class VsCodeExtension { void this.core.invoke("didChangeActiveTextEditor", { filepath }); }); - const originalValue = vscode.workspace + const enableContinueHub = vscode.workspace .getConfiguration(EXTENSION_NAME) - .get("continueTestEnvironment"); + .get("enableContinueHub"); vscode.workspace.onDidChangeConfiguration(async (event) => { if (event.affectsConfiguration(EXTENSION_NAME)) { const settings = this.ide.getIdeSettingsSync(); @@ -386,7 +386,11 @@ export class VsCodeExtension { settings, }); - if (settings.continueTestEnvironment !== originalValue) { + if ( + enableContinueHub + ? settings.continueTestEnvironment !== "production" + : settings.continueTestEnvironment === "production" + ) { await vscode.commands.executeCommand("workbench.action.reloadWindow"); } } diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index a150d2cd8..de10f9c7d 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -20,17 +20,15 @@ import { 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", + workspace.getConfiguration(EXTENSION_NAME).get("enableContinueHub") + ? "production" + : "none", ); const SESSIONS_SECRET_KEY = `${controlPlaneEnv.AUTH_TYPE}.sessions`; From 59001a399a2e0fdaf319a7622a8fcd4bc1bfa0e9 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 29 Jan 2025 13:27:59 -0800 Subject: [PATCH 51/57] 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 b74dcbd5d..9422232bd 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.256", + "version": "0.9.257", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 0879fcde92017a356fb02277dff3d314b4b7690c Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 29 Jan 2025 13:48:35 -0800 Subject: [PATCH 52/57] hotfix package.json --- extensions/vscode/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 9422232bd..138acb063 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -534,12 +534,12 @@ { "command": "continue.signInToControlPlane", "group": "navigation@5", - "when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.continueTestEnvironment !== 'none') && !continue.isSignedInToControlPlane" + "when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.enableContinueHub) && !continue.isSignedInToControlPlane" }, { "command": "continue.openAccountDialog", "group": "navigation@5", - "when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.continueTestEnvironment !== 'none') && continue.isSignedInToControlPlane" + "when": "(view == continue.continueGUIView) && (config.continue.enableContinueForTeams || config.continue.enableContinueHub) && continue.isSignedInToControlPlane" }, { "command": "continue.openMorePage", From 0915ea993e5d29aa43b56fa03dc04ba1b2d230af Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:02:21 -0800 Subject: [PATCH 53/57] require permission --- .github/workflows/pr_checks.yaml | 69 +++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 81fb93701..f5a8ed0ac 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -1,7 +1,7 @@ name: PR checks on: - pull_request: + pull_request_target: branches: - main paths: @@ -22,10 +22,22 @@ on: - ".github/workflows/**" jobs: + validate-pr: + runs-on: ubuntu-latest + environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} + steps: + - uses: actions/checkout@v4 + install-root: + needs: validate-pr runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + # This is important - it switches from the base repo to the fork + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -45,6 +57,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -70,10 +86,13 @@ 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: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -103,6 +122,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -134,6 +157,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -164,6 +191,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -200,6 +231,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -233,6 +268,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -264,6 +303,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -290,6 +333,9 @@ jobs: test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Cache node modules uses: actions/cache@v3 @@ -317,6 +363,10 @@ jobs: needs: [install-vscode, install-core] steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -349,6 +399,10 @@ jobs: needs: [install-vscode, install-core] steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -397,6 +451,10 @@ jobs: command: ["e2e:ci:run", "e2e:ci:run-yaml"] steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -459,6 +517,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -490,6 +552,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - uses: actions/cache@v4 with: From 3e5f0738db4e80bb24f2757414ff2f36223b6476 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:10:11 -0800 Subject: [PATCH 54/57] adjust padding --- gui/src/components/StepContainer/Reasoning.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx index 9b57dbb99..27ad10120 100644 --- a/gui/src/components/StepContainer/Reasoning.tsx +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -1,3 +1,4 @@ +import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid"; import { ChatHistoryItem } from "core"; import { stripImages } from "core/util/messageContent"; import { useEffect, useState } from "react"; @@ -10,7 +11,6 @@ import { } from ".."; import { getFontSize } from "../../util"; import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; -import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid"; interface ReasoningProps { item: ChatHistoryItem; @@ -49,6 +49,7 @@ const ButtonContent = styled.div` const ContentDiv = styled.div<{ fontSize?: number }>` margin: 4px; padding: 4px; + padding-bottom: 6px; font-size: ${getFontSize()}px; overflow: hidden; border-left: 4px solid ${lightGray}; @@ -134,4 +135,4 @@ export default function Reasoning(props: ReasoningProps) { )} ); -} \ No newline at end of file +} From f15e0fa6257f19c95eea3e1f5b5b858989ec8807 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:31:04 -0800 Subject: [PATCH 55/57] env --- .github/workflows/pr_checks.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index f5a8ed0ac..ccc9e8a44 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -24,7 +24,7 @@ on: jobs: validate-pr: runs-on: ubuntu-latest - environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} + environment: tests-requiring-secrets steps: - uses: actions/checkout@v4 @@ -86,7 +86,7 @@ jobs: core-checks: needs: install-core runs-on: ubuntu-latest - environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} + environment: tests-requiring-secrets steps: - uses: actions/checkout@v4 with: @@ -443,7 +443,7 @@ jobs: ] runs-on: ubuntu-latest # Tests requiring secrets need approval from maintainers - environment: ${{ github.event.pull_request.head.repo.fork && 'tests-requiring-secrets' || '' }} + environment: tests-requiring-secrets strategy: fail-fast: false matrix: From a2b4c3a8b888059a56d38b44959f0814340b29e2 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:32:11 -0800 Subject: [PATCH 56/57] update padding --- gui/src/components/StepContainer/Reasoning.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx index 27ad10120..d5537c82b 100644 --- a/gui/src/components/StepContainer/Reasoning.tsx +++ b/gui/src/components/StepContainer/Reasoning.tsx @@ -49,7 +49,7 @@ const ButtonContent = styled.div` const ContentDiv = styled.div<{ fontSize?: number }>` margin: 4px; padding: 4px; - padding-bottom: 6px; + padding-bottom: 8px; font-size: ${getFontSize()}px; overflow: hidden; border-left: 4px solid ${lightGray}; From 28f377afae3670c56f744efda0cce0b5ce0f4ece Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 30 Jan 2025 09:34:30 -0800 Subject: [PATCH 57/57] 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 fd5f55a70..9664499f4 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.255", + "version": "0.9.258", "repository": { "type": "git", "url": "https://github.com/continuedev/continue"