From 47e9c92e70c18f05adcf04105e70f62d8f82d4e5 Mon Sep 17 00:00:00 2001 From: Ross Golder Date: Thu, 2 Oct 2025 20:38:51 +0700 Subject: [PATCH 01/42] docs: add CLI telemetry opt-out instructions Add documentation for disabling telemetry in the Continue CLI using the CONTINUE_CLI_ENABLE_TELEMETRY=0 environment variable. Generated with [Continue](https://continue.dev) Co-Authored-By: Continue --- docs/telemetry.mdx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/telemetry.mdx b/docs/telemetry.mdx index dba2dc6d5..c55d64896 100644 --- a/docs/telemetry.mdx +++ b/docs/telemetry.mdx @@ -26,6 +26,23 @@ The following usage information is collected and reported: ## How to Opt Out +### VS Code Extension + You can disable anonymous telemetry by toggling "Allow Anonymous Telemetry" off in the user settings. Alternatively in VS Code, you can disable telemetry through your VS Code settings by unchecking the "Continue: Telemetry Enabled" box (this will override the Settings Page settings). VS Code settings can be accessed with `File` > `Preferences` > `Settings` (or use the keyboard shortcut `ctrl` + `,` on Windows/Linux or `cmd` + `,` on macOS). + +### CLI + +For the Continue CLI, set the environment variable `CONTINUE_CLI_ENABLE_TELEMETRY=0` before running commands: + +```bash +export CONTINUE_CLI_ENABLE_TELEMETRY=0 +cn +``` + +Or run it inline: + +```bash +CONTINUE_CLI_ENABLE_TELEMETRY=0 cn +``` From a0a287e9789b498ab7e3c3722a21af1dd2b033fa Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 13:13:57 -0700 Subject: [PATCH 02/42] feat: cli banner --- .../config/components/CliInstallBanner.tsx | 85 +++++++++++++++++++ gui/src/pages/config/index.tsx | 8 +- 2 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 gui/src/pages/config/components/CliInstallBanner.tsx diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx new file mode 100644 index 000000000..013f5ef5a --- /dev/null +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -0,0 +1,85 @@ +import { CommandLineIcon, XMarkIcon } from "@heroicons/react/24/outline"; +import { useContext, useEffect, useState } from "react"; +import Alert from "../../../components/gui/Alert"; +import { Button } from "../../../components/ui/Button"; +import { IdeMessengerContext } from "../../../context/IdeMessenger"; +import { getPlatform } from "../../../util"; + +export function CliInstallBanner() { + const ideMessenger = useContext(IdeMessengerContext); + const [cliInstalled, setCliInstalled] = useState(null); + const [dismissed, setDismissed] = useState(false); + + useEffect(() => { + const checkCliInstallation = async () => { + try { + const platform = getPlatform(); + // Use 'which' on mac/linux, 'where' on windows + const command = platform === "windows" ? "where cn" : "which cn"; + + const [stdout, stderr] = await ideMessenger.ide.subprocess(command); + + // If stdout has content (path to cn), it's installed + // If empty or stderr has "not found", it's not installed + const isInstalled = + stdout.trim().length > 0 && !stderr.includes("not found"); + setCliInstalled(isInstalled); + } catch (error) { + // If subprocess throws an error, assume CLI is not installed + setCliInstalled(false); + } + }; + + checkCliInstallation(); + }, [ideMessenger]); + + // Don't show if still loading, already installed, or dismissed + // if (cliInstalled === null || cliInstalled === true || dismissed) { + // return null; + // } + + return ( +
+ +
+ +
+
Try the Continue CLI
+
+ Use{" "} + + cn + {" "} + in your terminal for command-line coding assistance with + interactive and headless modes. +
+
+ + npm i -g @continuedev/cli + + +
+
+ +
+
+
+ ); +} diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index 283f48dff..eae76dbd8 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -8,6 +8,7 @@ import { TabGroup } from "../../components/ui/TabGroup"; import { useAuth } from "../../context/Auth"; import { useNavigationListener } from "../../hooks/useNavigationListener"; import { bottomTabSections, getAllTabs, topTabSections } from "./configTabs"; +import { CliInstallBanner } from "./components/CliInstallBanner"; import { AccountDropdown } from "./features/account/AccountDropdown"; function ConfigPage() { @@ -89,8 +90,11 @@ function ConfigPage() { {/* Tab Content for larger screens (md and above) */} -
- {allTabs.find((tab) => tab.id === activeTab)?.component} +
+
+ {allTabs.find((tab) => tab.id === activeTab)?.component} +
+
From 3be744b70e2d5b20064a1c868b2a68e108a6d947 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 13:24:47 -0700 Subject: [PATCH 03/42] improv: ui --- .../config/components/CliInstallBanner.tsx | 67 ++++++++++--------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index 013f5ef5a..82a0e5ddd 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -1,7 +1,7 @@ import { CommandLineIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { useContext, useEffect, useState } from "react"; -import Alert from "../../../components/gui/Alert"; -import { Button } from "../../../components/ui/Button"; +import { SecondaryButton } from "../../../components"; +import { Card } from "../../../components/ui"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { getPlatform } from "../../../util"; @@ -34,52 +34,55 @@ export function CliInstallBanner() { }, [ideMessenger]); // Don't show if still loading, already installed, or dismissed - // if (cliInstalled === null || cliInstalled === true || dismissed) { - // return null; - // } + if (cliInstalled === null || cliInstalled === true || dismissed) { + // return null; + } return (
- -
- -
-
Try the Continue CLI
-
- Use{" "} - - cn - {" "} - in your terminal for command-line coding assistance with - interactive and headless modes. + + +
+ +
+
+
+ Try the Continue CLI +
+
+ Use{" "} + + cn + {" "} + in your terminal for command-line coding assistance with + interactive and headless modes. +
-
- +
+ npm i -g @continuedev/cli - + Learn more +
-
- +
); } From ad32ef378a1175dfa82b5360e7bce2c92fdaca25 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 13:32:54 -0700 Subject: [PATCH 04/42] improv: ui --- .../config/components/CliInstallBanner.tsx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index 82a0e5ddd..3d9472ab0 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -1,6 +1,6 @@ import { CommandLineIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { useContext, useEffect, useState } from "react"; -import { SecondaryButton } from "../../../components"; +import { CloseButton, SecondaryButton } from "../../../components"; import { Card } from "../../../components/ui"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { getPlatform } from "../../../util"; @@ -41,16 +41,12 @@ export function CliInstallBanner() { return (
- -
+ setDismissed(true)}> + + +
-
+
Try the Continue CLI @@ -64,7 +60,7 @@ export function CliInstallBanner() { interactive and headless modes.
-
+
npm i -g @continuedev/cli From bd65b07d3276466a9b1cb22ab3e775da13d3f3ab Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 13:37:34 -0700 Subject: [PATCH 05/42] improv: banner --- gui/src/pages/config/components/CliInstallBanner.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index 3d9472ab0..f2c2cd603 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -35,7 +35,7 @@ export function CliInstallBanner() { // Don't show if still loading, already installed, or dismissed if (cliInstalled === null || cliInstalled === true || dismissed) { - // return null; + return null; } return ( From ab1f072eae328f6c4d94144726658ad9418a8300 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 13:55:28 -0700 Subject: [PATCH 06/42] test: cli banner --- .../components/CliInstallBanner.test.tsx | 280 ++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 gui/src/pages/config/components/CliInstallBanner.test.tsx diff --git a/gui/src/pages/config/components/CliInstallBanner.test.tsx b/gui/src/pages/config/components/CliInstallBanner.test.tsx new file mode 100644 index 000000000..d226e9b4e --- /dev/null +++ b/gui/src/pages/config/components/CliInstallBanner.test.tsx @@ -0,0 +1,280 @@ +import { + act, + fireEvent, + render, + screen, + waitFor, +} from "@testing-library/react"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { IdeMessengerContext } from "../../../context/IdeMessenger"; +import { MockIdeMessenger } from "../../../context/MockIdeMessenger"; +import * as util from "../../../util"; +import { CliInstallBanner } from "./CliInstallBanner"; + +vi.mock("../../../util", async () => { + const actual = await vi.importActual("../../../util"); + return { + ...actual, + getPlatform: vi.fn(), + }; +}); + +describe("CliInstallBanner", () => { + let mockIdeMessenger: MockIdeMessenger; + + beforeEach(() => { + vi.clearAllMocks(); + mockIdeMessenger = new MockIdeMessenger(); + vi.mocked(util.getPlatform).mockReturnValue("mac"); + }); + + const renderComponent = async (subprocessResponse: [string, string]) => { + // Mock the subprocess call on the IDE + vi.spyOn(mockIdeMessenger.ide, "subprocess").mockResolvedValue( + subprocessResponse, + ); + + return act(async () => + render( + + + , + ), + ); + }; + + describe("CLI detection", () => { + it("does not render when CLI is installed (subprocess returns path)", async () => { + await renderComponent(["/usr/local/bin/cn", ""]); + + await waitFor(() => { + expect( + screen.queryByText("Try the Continue CLI"), + ).not.toBeInTheDocument(); + }); + }); + + it("renders when CLI is not installed (subprocess returns empty)", async () => { + await renderComponent(["", "command not found"]); + + await waitFor(() => { + expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + }); + }); + + it("renders when CLI is not installed (subprocess returns empty stdout)", async () => { + await renderComponent(["", ""]); + + await waitFor(() => { + expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + }); + }); + + it("uses 'which cn' command on mac platform", async () => { + vi.mocked(util.getPlatform).mockReturnValue("mac"); + const subprocessSpy = vi + .spyOn(mockIdeMessenger.ide, "subprocess") + .mockResolvedValue(["", ""]); + + await renderComponent(["", ""]); + + await waitFor(() => { + expect(subprocessSpy).toHaveBeenCalledWith("which cn"); + }); + }); + + it("uses 'which cn' command on linux platform", async () => { + vi.mocked(util.getPlatform).mockReturnValue("linux"); + const subprocessSpy = vi + .spyOn(mockIdeMessenger.ide, "subprocess") + .mockResolvedValue(["", ""]); + + await renderComponent(["", ""]); + + await waitFor(() => { + expect(subprocessSpy).toHaveBeenCalledWith("which cn"); + }); + }); + + it("uses 'where cn' command on windows platform", async () => { + vi.mocked(util.getPlatform).mockReturnValue("windows"); + const subprocessSpy = vi + .spyOn(mockIdeMessenger.ide, "subprocess") + .mockResolvedValue(["", ""]); + + await renderComponent(["", ""]); + + await waitFor(() => { + expect(subprocessSpy).toHaveBeenCalledWith("where cn"); + }); + }); + + it("handles subprocess errors gracefully", async () => { + vi.spyOn(mockIdeMessenger.ide, "subprocess").mockRejectedValue( + new Error("Command failed"), + ); + + await act(async () => + render( + + + , + ), + ); + + await waitFor(() => { + expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + }); + }); + }); + + describe("Banner content", () => { + beforeEach(async () => { + await renderComponent(["", "not found"]); + await waitFor(() => { + expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + }); + }); + + it("displays the title", () => { + expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + }); + + it("displays the description with 'cn' code element", () => { + const description = screen.getByText(/Use/); + expect(description).toBeInTheDocument(); + expect(screen.getByText("cn")).toBeInTheDocument(); + }); + + it("displays the installation command", () => { + expect(screen.getByText("npm i -g @continuedev/cli")).toBeInTheDocument(); + }); + + it("displays the Learn more button", () => { + expect(screen.getByText("Learn more")).toBeInTheDocument(); + }); + + it("displays the close button", () => { + const closeButton = screen.getByRole("button", { name: /dismiss/i }); + expect(closeButton).toBeInTheDocument(); + }); + + it("displays the CommandLine icon", () => { + // The icon should be present in the component + const banner = screen.getByText("Try the Continue CLI").closest("div"); + expect(banner).toBeInTheDocument(); + }); + }); + + describe("User interactions", () => { + beforeEach(async () => { + await renderComponent(["", "not found"]); + await waitFor(() => { + expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + }); + }); + + it("dismisses banner when close button is clicked", async () => { + const closeButton = screen.getByRole("button", { name: /dismiss/i }); + fireEvent.click(closeButton); + + await waitFor(() => { + expect( + screen.queryByText("Try the Continue CLI"), + ).not.toBeInTheDocument(); + }); + }); + + it("opens documentation URL when Learn more button is clicked", async () => { + const postSpy = vi.spyOn(mockIdeMessenger, "post"); + const learnMoreButton = screen.getByText("Learn more"); + + fireEvent.click(learnMoreButton); + + expect(postSpy).toHaveBeenCalledWith( + "openUrl", + "https://docs.continue.dev/guides/cli", + ); + }); + }); + + describe("Banner visibility states", () => { + it("does not render while CLI check is loading", async () => { + vi.spyOn(mockIdeMessenger.ide, "subprocess").mockImplementation( + () => + new Promise((resolve) => setTimeout(() => resolve(["", ""]), 100)), + ); + + await act(async () => + render( + + + , + ), + ); + + // Should not be visible immediately + expect( + screen.queryByText("Try the Continue CLI"), + ).not.toBeInTheDocument(); + }); + + it("remains hidden after dismissal even on re-render", async () => { + const { rerender } = await renderComponent(["", "not found"]); + + await waitFor(() => { + expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + }); + + // Dismiss the banner + const closeButton = screen.getByRole("button", { name: /dismiss/i }); + fireEvent.click(closeButton); + + await waitFor(() => { + expect( + screen.queryByText("Try the Continue CLI"), + ).not.toBeInTheDocument(); + }); + + // Re-render the component + rerender( + + + , + ); + + // Should still be hidden + expect( + screen.queryByText("Try the Continue CLI"), + ).not.toBeInTheDocument(); + }); + }); + + describe("Edge cases", () => { + it("handles whitespace in subprocess output", async () => { + await renderComponent([" \n ", ""]); + + await waitFor(() => { + expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + }); + }); + + it("detects CLI when path has trailing newline", async () => { + await renderComponent(["/usr/local/bin/cn\n", ""]); + + await waitFor(() => { + expect( + screen.queryByText("Try the Continue CLI"), + ).not.toBeInTheDocument(); + }); + }); + + it("renders banner when stderr contains 'not found'", async () => { + await renderComponent(["", "cn: command not found"]); + + await waitFor(() => { + expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + }); + }); + }); +}); From f5999a6cccca4a0105488c72b9878dfe7e11f1d8 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 14:02:44 -0700 Subject: [PATCH 07/42] improv: ui --- .../components/CliInstallBanner.test.tsx | 24 +++++++++++++++++++ .../config/components/CliInstallBanner.tsx | 14 ++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.test.tsx b/gui/src/pages/config/components/CliInstallBanner.test.tsx index d226e9b4e..9d1f8e989 100644 --- a/gui/src/pages/config/components/CliInstallBanner.test.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.test.tsx @@ -196,6 +196,30 @@ describe("CliInstallBanner", () => { "https://docs.continue.dev/guides/cli", ); }); + + it("copies installation command when copy button is clicked", async () => { + // Find the copy button (ClipboardIcon) + const copyButtons = screen.getAllByRole("button"); + const copyButton = copyButtons.find((btn) => + btn.querySelector('svg[class*="ClipboardIcon"]'), + ); + + expect(copyButton).toBeDefined(); + }); + + it("runs installation command in terminal when run button is clicked", async () => { + const postSpy = vi.spyOn(mockIdeMessenger, "post"); + + // Find the "Run" text or CommandLineIcon + const runButton = screen.getByText(/Run/i).closest("div"); + if (runButton) { + fireEvent.click(runButton); + + expect(postSpy).toHaveBeenCalledWith("runCommand", { + command: "npm i -g @continuedev/cli", + }); + } + }); }); describe("Banner visibility states", () => { diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index f2c2cd603..ec8d09362 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -1,6 +1,8 @@ import { CommandLineIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { useContext, useEffect, useState } from "react"; import { CloseButton, SecondaryButton } from "../../../components"; +import { CopyButton } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/CopyButton"; +import { RunInTerminalButton } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/RunInTerminalButton"; import { Card } from "../../../components/ui"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { getPlatform } from "../../../util"; @@ -61,9 +63,15 @@ export function CliInstallBanner() {
- - npm i -g @continuedev/cli - +
+ + npm i -g @continuedev/cli + +
+ + +
+
ideMessenger.post( From c714c62db1acf516649e7ef784d88c955f848e7d Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 14:07:12 -0700 Subject: [PATCH 08/42] improv: ui --- .../config/components/CliInstallBanner.tsx | 70 +++++++++---------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index ec8d09362..6abe87da5 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -46,44 +46,42 @@ export function CliInstallBanner() { setDismissed(true)}> -
- -
-
-
- Try the Continue CLI -
-
- Use{" "} - - cn - {" "} - in your terminal for command-line coding assistance with - interactive and headless modes. +
+
+
+ + Try the Continue CLI +
+
+ Use{" "} + + cn + {" "} + in your terminal for command-line coding assistance with + interactive and headless modes. +
+
+
+
+ + npm i -g @continuedev/cli + +
+ +
-
-
- - npm i -g @continuedev/cli - -
- - -
-
- - ideMessenger.post( - "openUrl", - "https://docs.continue.dev/guides/cli", - ) - } - style={{ margin: 0 }} - > - Learn more - -
+ + ideMessenger.post( + "openUrl", + "https://docs.continue.dev/guides/cli", + ) + } + style={{ margin: 0 }} + > + Learn more +
From 351070cf4c743da19c404971e126166d2b5cee36 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 14:16:39 -0700 Subject: [PATCH 09/42] improv: ui --- gui/src/pages/config/components/CliInstallBanner.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index 6abe87da5..c331ebfa6 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -61,8 +61,8 @@ export function CliInstallBanner() { interactive and headless modes.
-
-
+
+
npm i -g @continuedev/cli From a873873b72950939d318b8ddcd9e951435a5f704 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 14:19:48 -0700 Subject: [PATCH 10/42] improv: ui --- gui/src/pages/config/components/CliInstallBanner.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index c331ebfa6..a220d663d 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -62,7 +62,7 @@ export function CliInstallBanner() {
-
+
npm i -g @continuedev/cli From 8a5e320e1cf4e5838ae7e9df1425ebe797fc181c Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 14:23:12 -0700 Subject: [PATCH 11/42] improv: ui --- gui/src/pages/config/components/CliInstallBanner.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index a220d663d..d6fb47bb6 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -68,7 +68,9 @@ export function CliInstallBanner() {
- +
Date: Mon, 6 Oct 2025 14:37:57 -0700 Subject: [PATCH 12/42] improv: ui --- .../config/components/CliInstallBanner.tsx | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index d6fb47bb6..c13ab8723 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -50,15 +50,26 @@ export function CliInstallBanner() {
- Try the Continue CLI + Try out the Continue CLI
Use{" "} cn {" "} - in your terminal for command-line coding assistance with - interactive and headless modes. + in your terminal interactively and then deploy Continuous AI + workflows.{" "} + + ideMessenger.post( + "openUrl", + "https://docs.continue.dev/guides/cli", + ) + } + className="cursor-pointer underline hover:brightness-125" + > + Learn more. +
@@ -73,17 +84,6 @@ export function CliInstallBanner() { />
- - ideMessenger.post( - "openUrl", - "https://docs.continue.dev/guides/cli", - ) - } - style={{ margin: 0 }} - > - Learn more -
From 966998465f1614ab1a0d3f346e5da1ace5b1de2e Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 14:41:38 -0700 Subject: [PATCH 13/42] improv: ui --- gui/src/pages/config/components/CliInstallBanner.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index c13ab8723..075ea0de6 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -1,6 +1,6 @@ import { CommandLineIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { useContext, useEffect, useState } from "react"; -import { CloseButton, SecondaryButton } from "../../../components"; +import { CloseButton } from "../../../components"; import { CopyButton } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/CopyButton"; import { RunInTerminalButton } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/RunInTerminalButton"; import { Card } from "../../../components/ui"; @@ -78,7 +78,9 @@ export function CliInstallBanner() { npm i -g @continuedev/cli
- + From 53da290d3e7d1edc62839aac0116596262bdfc36 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 15:45:54 -0700 Subject: [PATCH 14/42] improv: ui --- .../components/CliInstallBanner.test.tsx | 261 +++++++++++++++--- .../config/components/CliInstallBanner.tsx | 52 +++- gui/src/pages/gui/Chat.tsx | 12 + gui/src/util/localStorage.ts | 1 + 4 files changed, 283 insertions(+), 43 deletions(-) diff --git a/gui/src/pages/config/components/CliInstallBanner.test.tsx b/gui/src/pages/config/components/CliInstallBanner.test.tsx index 9d1f8e989..5bf24bc2e 100644 --- a/gui/src/pages/config/components/CliInstallBanner.test.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.test.tsx @@ -9,6 +9,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { MockIdeMessenger } from "../../../context/MockIdeMessenger"; import * as util from "../../../util"; +import * as localStorage from "../../../util/localStorage"; import { CliInstallBanner } from "./CliInstallBanner"; vi.mock("../../../util", async () => { @@ -19,6 +20,15 @@ vi.mock("../../../util", async () => { }; }); +vi.mock("../../../util/localStorage", async () => { + const actual = await vi.importActual("../../../util/localStorage"); + return { + ...actual, + getLocalStorage: vi.fn(), + setLocalStorage: vi.fn(), + }; +}); + describe("CliInstallBanner", () => { let mockIdeMessenger: MockIdeMessenger; @@ -26,6 +36,7 @@ describe("CliInstallBanner", () => { vi.clearAllMocks(); mockIdeMessenger = new MockIdeMessenger(); vi.mocked(util.getPlatform).mockReturnValue("mac"); + vi.mocked(localStorage.getLocalStorage).mockReturnValue(undefined); }); const renderComponent = async (subprocessResponse: [string, string]) => { @@ -49,7 +60,7 @@ describe("CliInstallBanner", () => { await waitFor(() => { expect( - screen.queryByText("Try the Continue CLI"), + screen.queryByText("Try out the Continue CLI"), ).not.toBeInTheDocument(); }); }); @@ -58,7 +69,9 @@ describe("CliInstallBanner", () => { await renderComponent(["", "command not found"]); await waitFor(() => { - expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); }); }); @@ -66,7 +79,9 @@ describe("CliInstallBanner", () => { await renderComponent(["", ""]); await waitFor(() => { - expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); }); }); @@ -76,7 +91,13 @@ describe("CliInstallBanner", () => { .spyOn(mockIdeMessenger.ide, "subprocess") .mockResolvedValue(["", ""]); - await renderComponent(["", ""]); + await act(async () => + render( + + + , + ), + ); await waitFor(() => { expect(subprocessSpy).toHaveBeenCalledWith("which cn"); @@ -89,7 +110,13 @@ describe("CliInstallBanner", () => { .spyOn(mockIdeMessenger.ide, "subprocess") .mockResolvedValue(["", ""]); - await renderComponent(["", ""]); + await act(async () => + render( + + + , + ), + ); await waitFor(() => { expect(subprocessSpy).toHaveBeenCalledWith("which cn"); @@ -102,7 +129,13 @@ describe("CliInstallBanner", () => { .spyOn(mockIdeMessenger.ide, "subprocess") .mockResolvedValue(["", ""]); - await renderComponent(["", ""]); + await act(async () => + render( + + + , + ), + ); await waitFor(() => { expect(subprocessSpy).toHaveBeenCalledWith("where cn"); @@ -123,7 +156,9 @@ describe("CliInstallBanner", () => { ); await waitFor(() => { - expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); }); }); }); @@ -132,12 +167,14 @@ describe("CliInstallBanner", () => { beforeEach(async () => { await renderComponent(["", "not found"]); await waitFor(() => { - expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); }); }); it("displays the title", () => { - expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + expect(screen.getByText("Try out the Continue CLI")).toBeInTheDocument(); }); it("displays the description with 'cn' code element", () => { @@ -150,18 +187,22 @@ describe("CliInstallBanner", () => { expect(screen.getByText("npm i -g @continuedev/cli")).toBeInTheDocument(); }); - it("displays the Learn more button", () => { - expect(screen.getByText("Learn more")).toBeInTheDocument(); + it("displays the Learn more link", () => { + expect(screen.getByText("Learn more.")).toBeInTheDocument(); }); it("displays the close button", () => { - const closeButton = screen.getByRole("button", { name: /dismiss/i }); - expect(closeButton).toBeInTheDocument(); + // Get the styled close button (it doesn't have a text label) + const buttons = screen.getAllByRole("button"); + // There should be multiple buttons (close, copy, run) + expect(buttons.length).toBeGreaterThan(0); }); it("displays the CommandLine icon", () => { // The icon should be present in the component - const banner = screen.getByText("Try the Continue CLI").closest("div"); + const banner = screen + .getByText("Try out the Continue CLI") + .closest("div"); expect(banner).toBeInTheDocument(); }); }); @@ -170,26 +211,30 @@ describe("CliInstallBanner", () => { beforeEach(async () => { await renderComponent(["", "not found"]); await waitFor(() => { - expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); }); }); it("dismisses banner when close button is clicked", async () => { - const closeButton = screen.getByRole("button", { name: /dismiss/i }); + const buttons = screen.getAllByRole("button"); + // First button should be the close button (CloseButton component) + const closeButton = buttons[0]; fireEvent.click(closeButton); await waitFor(() => { expect( - screen.queryByText("Try the Continue CLI"), + screen.queryByText("Try out the Continue CLI"), ).not.toBeInTheDocument(); }); }); - it("opens documentation URL when Learn more button is clicked", async () => { + it("opens documentation URL when Learn more link is clicked", async () => { const postSpy = vi.spyOn(mockIdeMessenger, "post"); - const learnMoreButton = screen.getByText("Learn more"); + const learnMoreLink = screen.getByText("Learn more."); - fireEvent.click(learnMoreButton); + fireEvent.click(learnMoreLink); expect(postSpy).toHaveBeenCalledWith( "openUrl", @@ -197,14 +242,11 @@ describe("CliInstallBanner", () => { ); }); - it("copies installation command when copy button is clicked", async () => { - // Find the copy button (ClipboardIcon) - const copyButtons = screen.getAllByRole("button"); - const copyButton = copyButtons.find((btn) => - btn.querySelector('svg[class*="ClipboardIcon"]'), - ); - - expect(copyButton).toBeDefined(); + it("displays the installation command with interactive controls", async () => { + // The installation command should be visible + expect(screen.getByText("npm i -g @continuedev/cli")).toBeInTheDocument(); + // The "Run" text should be visible for the run button + expect(screen.getByText(/Run/i)).toBeInTheDocument(); }); it("runs installation command in terminal when run button is clicked", async () => { @@ -216,7 +258,7 @@ describe("CliInstallBanner", () => { fireEvent.click(runButton); expect(postSpy).toHaveBeenCalledWith("runCommand", { - command: "npm i -g @continuedev/cli", + command: `npm i -g @continuedev/cli && cn "Explore this repo and provide a concise summary of it's contents"`, }); } }); @@ -239,7 +281,7 @@ describe("CliInstallBanner", () => { // Should not be visible immediately expect( - screen.queryByText("Try the Continue CLI"), + screen.queryByText("Try out the Continue CLI"), ).not.toBeInTheDocument(); }); @@ -247,16 +289,19 @@ describe("CliInstallBanner", () => { const { rerender } = await renderComponent(["", "not found"]); await waitFor(() => { - expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); }); // Dismiss the banner - const closeButton = screen.getByRole("button", { name: /dismiss/i }); + const buttons = screen.getAllByRole("button"); + const closeButton = buttons[0]; fireEvent.click(closeButton); await waitFor(() => { expect( - screen.queryByText("Try the Continue CLI"), + screen.queryByText("Try out the Continue CLI"), ).not.toBeInTheDocument(); }); @@ -269,7 +314,7 @@ describe("CliInstallBanner", () => { // Should still be hidden expect( - screen.queryByText("Try the Continue CLI"), + screen.queryByText("Try out the Continue CLI"), ).not.toBeInTheDocument(); }); }); @@ -279,7 +324,9 @@ describe("CliInstallBanner", () => { await renderComponent([" \n ", ""]); await waitFor(() => { - expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); }); }); @@ -288,7 +335,7 @@ describe("CliInstallBanner", () => { await waitFor(() => { expect( - screen.queryByText("Try the Continue CLI"), + screen.queryByText("Try out the Continue CLI"), ).not.toBeInTheDocument(); }); }); @@ -297,8 +344,148 @@ describe("CliInstallBanner", () => { await renderComponent(["", "cn: command not found"]); await waitFor(() => { - expect(screen.getByText("Try the Continue CLI")).toBeInTheDocument(); + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); }); }); }); + + describe("Message threshold logic", () => { + const renderWithMessageCount = async ( + messageCount?: number, + messageThreshold?: number, + ) => { + vi.spyOn(mockIdeMessenger.ide, "subprocess").mockResolvedValue([ + "", + "not found", + ]); + + return act(async () => + render( + + + , + ), + ); + }; + + it("shows banner when no threshold is set", async () => { + await renderWithMessageCount(0, undefined); + + await waitFor(() => { + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); + }); + }); + + it("does not show banner when message count is below threshold", async () => { + await renderWithMessageCount(2, 3); + + await waitFor(() => { + expect( + screen.queryByText("Try out the Continue CLI"), + ).not.toBeInTheDocument(); + }); + }); + + it("shows banner when message count meets threshold", async () => { + await renderWithMessageCount(3, 3); + + await waitFor(() => { + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); + }); + }); + + it("shows banner when message count exceeds threshold", async () => { + await renderWithMessageCount(5, 3); + + await waitFor(() => { + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); + }); + }); + }); + + describe("Permanent dismissal with localStorage", () => { + const renderWithPermanentDismissal = async () => { + vi.spyOn(mockIdeMessenger.ide, "subprocess").mockResolvedValue([ + "", + "not found", + ]); + + return act(async () => + render( + + + , + ), + ); + }; + + it("does not show banner when previously dismissed permanently", async () => { + vi.mocked(localStorage.getLocalStorage).mockReturnValue(true); + + await renderWithPermanentDismissal(); + + await waitFor(() => { + expect( + screen.queryByText("Try out the Continue CLI"), + ).not.toBeInTheDocument(); + }); + }); + + it("sets localStorage when dismissed with permanentDismissal=true", async () => { + await renderWithPermanentDismissal(); + + await waitFor(() => { + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); + }); + + const buttons = screen.getAllByRole("button"); + const closeButton = buttons[0]; + fireEvent.click(closeButton); + + expect(localStorage.setLocalStorage).toHaveBeenCalledWith( + "hasDismissedCliInstallBanner", + true, + ); + }); + + it("does not set localStorage when dismissed with permanentDismissal=false", async () => { + vi.spyOn(mockIdeMessenger.ide, "subprocess").mockResolvedValue([ + "", + "not found", + ]); + + await act(async () => + render( + + + , + ), + ); + + await waitFor(() => { + expect( + screen.getByText("Try out the Continue CLI"), + ).toBeInTheDocument(); + }); + + const buttons = screen.getAllByRole("button"); + const closeButton = buttons[0]; + fireEvent.click(closeButton); + + expect(localStorage.setLocalStorage).not.toHaveBeenCalled(); + }); + }); }); diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/pages/config/components/CliInstallBanner.tsx index 075ea0de6..8747d7ecd 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/pages/config/components/CliInstallBanner.tsx @@ -6,13 +6,36 @@ import { RunInTerminalButton } from "../../../components/StyledMarkdownPreview/S import { Card } from "../../../components/ui"; import { IdeMessengerContext } from "../../../context/IdeMessenger"; import { getPlatform } from "../../../util"; +import { getLocalStorage, setLocalStorage } from "../../../util/localStorage"; -export function CliInstallBanner() { +interface CliInstallBannerProps { + /** Current message count - banner shows only if >= messageThreshold */ + messageCount?: number; + /** Minimum messages before showing banner (default: always show) */ + messageThreshold?: number; + /** If true, dismissal is permanent via localStorage (default: session only) */ + permanentDismissal?: boolean; +} + +export function CliInstallBanner({ + messageCount, + messageThreshold, + permanentDismissal = false, +}: CliInstallBannerProps = {}) { const ideMessenger = useContext(IdeMessengerContext); const [cliInstalled, setCliInstalled] = useState(null); const [dismissed, setDismissed] = useState(false); useEffect(() => { + // Check if user has permanently dismissed the banner + if (permanentDismissal) { + const hasDismissed = getLocalStorage("hasDismissedCliInstallBanner"); + if (hasDismissed) { + setDismissed(true); + return; + } + } + const checkCliInstallation = async () => { try { const platform = getPlatform(); @@ -32,18 +55,35 @@ export function CliInstallBanner() { } }; - checkCliInstallation(); - }, [ideMessenger]); + void checkCliInstallation(); + }, [ideMessenger, permanentDismissal]); - // Don't show if still loading, already installed, or dismissed - if (cliInstalled === null || cliInstalled === true || dismissed) { + const handleDismiss = () => { + setDismissed(true); + if (permanentDismissal) { + setLocalStorage("hasDismissedCliInstallBanner", true); + } + }; + + // Don't show if: + // - Still loading CLI status + // - CLI is already installed + // - User has dismissed it + // - Message threshold not met (if threshold is set) + if ( + cliInstalled === null || + cliInstalled === true || + dismissed || + (messageThreshold !== undefined && + (messageCount === undefined || messageCount < messageThreshold)) + ) { return null; } return (
- setDismissed(true)}> +
diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 08ca69498..0fabb5faf 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -46,6 +46,7 @@ import { ToolCallDiv } from "./ToolCallDiv"; import { FatalErrorIndicator } from "../../components/config/FatalErrorNotice"; import InlineErrorMessage from "../../components/mainInput/InlineErrorMessage"; import { cancelStream } from "../../redux/thunks/cancelStream"; +import { CliInstallBanner } from "../config/components/CliInstallBanner"; import { EmptyChatBody } from "./EmptyChatBody"; import { ExploreDialogWatcher } from "./ExploreDialogWatcher"; import { useAutoScroll } from "./useAutoScroll"; @@ -380,6 +381,11 @@ export function Chat() { const showScrollbar = showChatScrollbar ?? window.innerHeight > 5000; + // Count user messages for CLI banner threshold + const userMessageCount = useMemo(() => { + return history.filter((item) => item.message.role === "user").length; + }, [history]); + return ( <> {!!showSessionTabs && !isInEdit && } @@ -421,6 +427,12 @@ export function Chat() { inputId={MAIN_EDITOR_INPUT_ID} /> + +
Date: Mon, 6 Oct 2025 15:57:29 -0700 Subject: [PATCH 15/42] improv: ui --- .../components/CliInstallBanner.test.tsx | 16 ++++++++-------- .../config => }/components/CliInstallBanner.tsx | 14 +++++++------- gui/src/pages/config/index.tsx | 2 +- gui/src/pages/gui/Chat.tsx | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) rename gui/src/{pages/config => }/components/CliInstallBanner.test.tsx (96%) rename gui/src/{pages/config => }/components/CliInstallBanner.tsx (89%) diff --git a/gui/src/pages/config/components/CliInstallBanner.test.tsx b/gui/src/components/CliInstallBanner.test.tsx similarity index 96% rename from gui/src/pages/config/components/CliInstallBanner.test.tsx rename to gui/src/components/CliInstallBanner.test.tsx index 5bf24bc2e..6f3208c65 100644 --- a/gui/src/pages/config/components/CliInstallBanner.test.tsx +++ b/gui/src/components/CliInstallBanner.test.tsx @@ -6,22 +6,22 @@ import { waitFor, } from "@testing-library/react"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import { IdeMessengerContext } from "../../../context/IdeMessenger"; -import { MockIdeMessenger } from "../../../context/MockIdeMessenger"; -import * as util from "../../../util"; -import * as localStorage from "../../../util/localStorage"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { MockIdeMessenger } from "../../context/MockIdeMessenger"; +import * as util from "../../util"; +import * as localStorage from "../../util/localStorage"; import { CliInstallBanner } from "./CliInstallBanner"; -vi.mock("../../../util", async () => { - const actual = await vi.importActual("../../../util"); +vi.mock("../../util", async () => { + const actual = await vi.importActual("../../util"); return { ...actual, getPlatform: vi.fn(), }; }); -vi.mock("../../../util/localStorage", async () => { - const actual = await vi.importActual("../../../util/localStorage"); +vi.mock("../../util/localStorage", async () => { + const actual = await vi.importActual("../../util/localStorage"); return { ...actual, getLocalStorage: vi.fn(), diff --git a/gui/src/pages/config/components/CliInstallBanner.tsx b/gui/src/components/CliInstallBanner.tsx similarity index 89% rename from gui/src/pages/config/components/CliInstallBanner.tsx rename to gui/src/components/CliInstallBanner.tsx index 8747d7ecd..c7011f7b7 100644 --- a/gui/src/pages/config/components/CliInstallBanner.tsx +++ b/gui/src/components/CliInstallBanner.tsx @@ -1,12 +1,12 @@ import { CommandLineIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { useContext, useEffect, useState } from "react"; -import { CloseButton } from "../../../components"; -import { CopyButton } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/CopyButton"; -import { RunInTerminalButton } from "../../../components/StyledMarkdownPreview/StepContainerPreToolbar/RunInTerminalButton"; -import { Card } from "../../../components/ui"; -import { IdeMessengerContext } from "../../../context/IdeMessenger"; -import { getPlatform } from "../../../util"; -import { getLocalStorage, setLocalStorage } from "../../../util/localStorage"; +import { CloseButton } from "."; +import { CopyButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/CopyButton"; +import { RunInTerminalButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/RunInTerminalButton"; +import { Card } from "./ui"; +import { IdeMessengerContext } from "../context/IdeMessenger"; +import { getPlatform } from "../util"; +import { getLocalStorage, setLocalStorage } from "../util/localStorage"; interface CliInstallBannerProps { /** Current message count - banner shows only if >= messageThreshold */ diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index eae76dbd8..d34d4bcbc 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -8,7 +8,7 @@ import { TabGroup } from "../../components/ui/TabGroup"; import { useAuth } from "../../context/Auth"; import { useNavigationListener } from "../../hooks/useNavigationListener"; import { bottomTabSections, getAllTabs, topTabSections } from "./configTabs"; -import { CliInstallBanner } from "./components/CliInstallBanner"; +import { CliInstallBanner } from "../../components/CliInstallBanner"; import { AccountDropdown } from "./features/account/AccountDropdown"; function ConfigPage() { diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 0fabb5faf..1bdc846e3 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -46,7 +46,7 @@ import { ToolCallDiv } from "./ToolCallDiv"; import { FatalErrorIndicator } from "../../components/config/FatalErrorNotice"; import InlineErrorMessage from "../../components/mainInput/InlineErrorMessage"; import { cancelStream } from "../../redux/thunks/cancelStream"; -import { CliInstallBanner } from "../config/components/CliInstallBanner"; +import { CliInstallBanner } from "../../components/CliInstallBanner"; import { EmptyChatBody } from "./EmptyChatBody"; import { ExploreDialogWatcher } from "./ExploreDialogWatcher"; import { useAutoScroll } from "./useAutoScroll"; From 039cab3776abad3ee75ce83248267522f97d4f08 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 16:44:07 -0700 Subject: [PATCH 16/42] improv: ui --- gui/src/components/CliInstallBanner.tsx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/gui/src/components/CliInstallBanner.tsx b/gui/src/components/CliInstallBanner.tsx index c7011f7b7..5eb91af98 100644 --- a/gui/src/components/CliInstallBanner.tsx +++ b/gui/src/components/CliInstallBanner.tsx @@ -1,12 +1,12 @@ import { CommandLineIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { useContext, useEffect, useState } from "react"; import { CloseButton } from "."; -import { CopyButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/CopyButton"; -import { RunInTerminalButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/RunInTerminalButton"; -import { Card } from "./ui"; import { IdeMessengerContext } from "../context/IdeMessenger"; import { getPlatform } from "../util"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; +import { CopyButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/CopyButton"; +import { RunInTerminalButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/RunInTerminalButton"; +import { Card } from "./ui"; interface CliInstallBannerProps { /** Current message count - banner shows only if >= messageThreshold */ @@ -77,7 +77,7 @@ export function CliInstallBanner({ (messageThreshold !== undefined && (messageCount === undefined || messageCount < messageThreshold)) ) { - return null; + // return null; } return ( @@ -113,11 +113,16 @@ export function CliInstallBanner({
-
- - npm i -g @continuedev/cli - -
+
+
+ + npm i -g @continuedev/cli + +
+
From fa6e558c45d227214a5f9ba78afe46d5104e80a1 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 16:47:05 -0700 Subject: [PATCH 17/42] improv: auto-copy --- gui/src/components/CliInstallBanner.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/gui/src/components/CliInstallBanner.tsx b/gui/src/components/CliInstallBanner.tsx index 5eb91af98..cb3cd59ca 100644 --- a/gui/src/components/CliInstallBanner.tsx +++ b/gui/src/components/CliInstallBanner.tsx @@ -1,9 +1,10 @@ import { CommandLineIcon, XMarkIcon } from "@heroicons/react/24/outline"; -import { useContext, useEffect, useState } from "react"; +import { useContext, useEffect, useRef, useState } from "react"; import { CloseButton } from "."; import { IdeMessengerContext } from "../context/IdeMessenger"; import { getPlatform } from "../util"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; +import useCopy from "../hooks/useCopy"; import { CopyButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/CopyButton"; import { RunInTerminalButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/RunInTerminalButton"; import { Card } from "./ui"; @@ -25,6 +26,21 @@ export function CliInstallBanner({ const ideMessenger = useContext(IdeMessengerContext); const [cliInstalled, setCliInstalled] = useState(null); const [dismissed, setDismissed] = useState(false); + const commandTextRef = useRef(null); + const { copyText } = useCopy("npm i -g @continuedev/cli"); + + const handleCommandClick = () => { + // Select the text + if (commandTextRef.current) { + const selection = window.getSelection(); + const range = document.createRange(); + range.selectNodeContents(commandTextRef.current); + selection?.removeAllRanges(); + selection?.addRange(range); + } + // Copy to clipboard + copyText(); + }; useEffect(() => { // Check if user has permanently dismissed the banner @@ -116,8 +132,10 @@ export function CliInstallBanner({
npm i -g @continuedev/cli From 8ec8795d1d974414b7b8f2292c844d7e630bab34 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 16:58:39 -0700 Subject: [PATCH 18/42] improv: ui --- gui/src/components/CliInstallBanner.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gui/src/components/CliInstallBanner.tsx b/gui/src/components/CliInstallBanner.tsx index cb3cd59ca..488b5333c 100644 --- a/gui/src/components/CliInstallBanner.tsx +++ b/gui/src/components/CliInstallBanner.tsx @@ -28,6 +28,7 @@ export function CliInstallBanner({ const [dismissed, setDismissed] = useState(false); const commandTextRef = useRef(null); const { copyText } = useCopy("npm i -g @continuedev/cli"); + const [showCopiedMessage, setShowCopiedMessage] = useState(false); const handleCommandClick = () => { // Select the text @@ -40,6 +41,10 @@ export function CliInstallBanner({ } // Copy to clipboard copyText(); + + // Show "Copied!" message for 3 seconds + setShowCopiedMessage(true); + setTimeout(() => setShowCopiedMessage(false), 3000); }; useEffect(() => { @@ -130,7 +135,7 @@ export function CliInstallBanner({
-
+
npm i -g @continuedev/cli + {showCopiedMessage && ( + + Copied! + + )}
Date: Mon, 6 Oct 2025 17:06:55 -0700 Subject: [PATCH 19/42] improv: ui --- gui/src/components/CliInstallBanner.tsx | 4 ++-- gui/src/pages/gui/Chat.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gui/src/components/CliInstallBanner.tsx b/gui/src/components/CliInstallBanner.tsx index 488b5333c..a6ceaa312 100644 --- a/gui/src/components/CliInstallBanner.tsx +++ b/gui/src/components/CliInstallBanner.tsx @@ -2,9 +2,9 @@ import { CommandLineIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { useContext, useEffect, useRef, useState } from "react"; import { CloseButton } from "."; import { IdeMessengerContext } from "../context/IdeMessenger"; +import useCopy from "../hooks/useCopy"; import { getPlatform } from "../util"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; -import useCopy from "../hooks/useCopy"; import { CopyButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/CopyButton"; import { RunInTerminalButton } from "./StyledMarkdownPreview/StepContainerPreToolbar/RunInTerminalButton"; import { Card } from "./ui"; @@ -98,7 +98,7 @@ export function CliInstallBanner({ (messageThreshold !== undefined && (messageCount === undefined || messageCount < messageThreshold)) ) { - // return null; + return null; } return ( diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 1bdc846e3..d0c2f45b4 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -43,15 +43,15 @@ import { streamResponseThunk } from "../../redux/thunks/streamResponse"; import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util"; import { ToolCallDiv } from "./ToolCallDiv"; +import { useStore } from "react-redux"; +import { CliInstallBanner } from "../../components/CliInstallBanner"; import { FatalErrorIndicator } from "../../components/config/FatalErrorNotice"; import InlineErrorMessage from "../../components/mainInput/InlineErrorMessage"; +import { RootState } from "../../redux/store"; import { cancelStream } from "../../redux/thunks/cancelStream"; -import { CliInstallBanner } from "../../components/CliInstallBanner"; import { EmptyChatBody } from "./EmptyChatBody"; import { ExploreDialogWatcher } from "./ExploreDialogWatcher"; import { useAutoScroll } from "./useAutoScroll"; -import { useStore } from "react-redux"; -import { RootState } from "../../redux/store"; // Helper function to find the index of the latest conversation summary function findLatestSummaryIndex(history: ChatHistoryItem[]): number { @@ -429,7 +429,7 @@ export function Chat() { From c1d09d8d2160658227431a77cc593381c9bc50f3 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 17:10:18 -0700 Subject: [PATCH 20/42] fix: dismissal --- gui/src/pages/config/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index d34d4bcbc..d672b3d09 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -94,7 +94,7 @@ function ConfigPage() {
{allTabs.find((tab) => tab.id === activeTab)?.component}
- +
From 914d587d11f67bff1f6ea7c882f2bbac5f1ee55e Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Mon, 6 Oct 2025 17:27:07 -0700 Subject: [PATCH 21/42] fix: type errors --- gui/src/components/CliInstallBanner.test.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gui/src/components/CliInstallBanner.test.tsx b/gui/src/components/CliInstallBanner.test.tsx index 6f3208c65..5904df50d 100644 --- a/gui/src/components/CliInstallBanner.test.tsx +++ b/gui/src/components/CliInstallBanner.test.tsx @@ -6,22 +6,22 @@ import { waitFor, } from "@testing-library/react"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import { IdeMessengerContext } from "../../context/IdeMessenger"; -import { MockIdeMessenger } from "../../context/MockIdeMessenger"; -import * as util from "../../util"; -import * as localStorage from "../../util/localStorage"; +import { IdeMessengerContext } from "../context/IdeMessenger"; +import { MockIdeMessenger } from "../context/MockIdeMessenger"; +import * as util from "../util"; +import * as localStorage from "../util/localStorage"; import { CliInstallBanner } from "./CliInstallBanner"; -vi.mock("../../util", async () => { - const actual = await vi.importActual("../../util"); +vi.mock("../util", async () => { + const actual = await vi.importActual("../util"); return { ...actual, getPlatform: vi.fn(), }; }); -vi.mock("../../util/localStorage", async () => { - const actual = await vi.importActual("../../util/localStorage"); +vi.mock("../util/localStorage", async () => { + const actual = await vi.importActual("../util/localStorage"); return { ...actual, getLocalStorage: vi.fn(), From 54c26c108b24fb405d2980f69b8091d660c05edc Mon Sep 17 00:00:00 2001 From: Ting-Wai To <40179554+tingwai@users.noreply.github.com> Date: Mon, 6 Oct 2025 18:56:01 -0700 Subject: [PATCH 22/42] feat: add GitHub workflow for vscode pre-release --- .github/workflows/vscode-prerelease.yml | 231 ++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 .github/workflows/vscode-prerelease.yml diff --git a/.github/workflows/vscode-prerelease.yml b/.github/workflows/vscode-prerelease.yml new file mode 100644 index 000000000..3bb67deb2 --- /dev/null +++ b/.github/workflows/vscode-prerelease.yml @@ -0,0 +1,231 @@ +name: VSCode Pre-release + +on: + workflow_dispatch: + inputs: + main_commit_sha: + description: "Main branch commit SHA to create pre-release from - leave empty to use HEAD of main" + required: false + type: string + prerelease_version: + description: "New pre-release version (e.g., 1.3.15) - leave empty to auto-increment" + required: false + type: string + +permissions: + contents: write + pull-requests: write + +jobs: + create-prerelease: + name: Create VSCode Pre-release + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + ref: ${{ inputs.main_commit_sha || 'main' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + node-version: 20 + + - name: Determine version numbers + id: version + working-directory: extensions/vscode + run: | + # Get current version from package.json + CURRENT_VERSION=$(node -p "require('./package.json').version") + echo "Current version in package.json: $CURRENT_VERSION" + + # Determine new pre-release version + if [[ -n "${{ inputs.prerelease_version }}" ]]; then + NEW_VERSION="${{ inputs.prerelease_version }}" + echo "Using manually specified new version: $NEW_VERSION" + else + # Auto-increment patch version + IFS='.' read -r major minor patch <<< "$CURRENT_VERSION" + NEW_PATCH=$((patch + 1)) + NEW_VERSION="${major}.${minor}.${NEW_PATCH}" + echo "Auto-incremented version: $NEW_VERSION" + fi + + TAG_NAME="v${NEW_VERSION}-vscode" + + echo "previous_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + + echo "Summary:" + echo " Previous version: $CURRENT_VERSION" + echo " New version: $NEW_VERSION" + echo " Tag name: $TAG_NAME" + + - name: Create pre-release branch + id: branch + run: | + BRANCH_NAME="prerelease/vscode-${{ steps.version.outputs.new_version }}" + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT + + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + git checkout -b "$BRANCH_NAME" + echo "Created branch: $BRANCH_NAME" + + - name: Update package.json version + working-directory: extensions/vscode + run: | + # Update version in package.json + npm version ${{ steps.version.outputs.new_version }} --no-git-tag-version + + echo "Updated package.json to version ${{ steps.version.outputs.new_version }}" + + - name: Commit version bump + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + git add extensions/vscode/package.json + git commit -m "chore: bump VSCode extension version to ${{ steps.version.outputs.new_version }}" + + echo "Committed version bump" + + - name: Push branch and create PR + id: pr + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git push origin "${{ steps.branch.outputs.branch_name }}" + echo "Pushed branch: ${{ steps.branch.outputs.branch_name }}" + + # Create pull request + PR_URL=$(gh pr create \ + --base main \ + --head "${{ steps.branch.outputs.branch_name }}" \ + --title "chore: VSCode pre-release ${{ steps.version.outputs.new_version }}" \ + --body "$(cat <<'EOF' + ## VSCode Pre-release ${{ steps.version.outputs.new_version }} + + This PR bumps the VSCode extension version for pre-release. + + ### Changes + - Version bumped from ${{ steps.version.outputs.previous_version }} to ${{ steps.version.outputs.new_version }} + - Based on commit: ${{ inputs.main_commit_sha }} + + ### Release Process + After merging this PR: + 1. The tag \`${{ steps.version.outputs.tag_name }}\` will be created automatically + 2. A GitHub pre-release will be created with auto-generated release notes + + 🤖 This PR was created automatically by the VSCode Pre-release workflow. + EOF + )") + + echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT + echo "Created PR: $PR_URL" + + - name: Auto-merge PR + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Get PR number from URL + PR_NUMBER=$(echo "${{ steps.pr.outputs.pr_url }}" | grep -oE '[0-9]+$') + + # Merge the PR + gh pr merge "$PR_NUMBER" --squash --auto + + echo "PR #$PR_NUMBER set to auto-merge" + + # Wait for merge to complete (with timeout) + echo "Waiting for PR to be merged..." + TIMEOUT=300 # 5 minutes + ELAPSED=0 + INTERVAL=10 + + while [ $ELAPSED -lt $TIMEOUT ]; do + PR_STATE=$(gh pr view "$PR_NUMBER" --json state --jq '.state') + if [ "$PR_STATE" = "MERGED" ]; then + echo "PR successfully merged!" + break + fi + sleep $INTERVAL + ELAPSED=$((ELAPSED + INTERVAL)) + echo "Still waiting... ($ELAPSED seconds elapsed)" + done + + if [ $ELAPSED -ge $TIMEOUT ]; then + echo "Warning: Timed out waiting for PR merge. Please check manually." + fi + + - name: Checkout main branch + run: | + git fetch origin main + git checkout main + git pull origin main + + - name: Create and push tag + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + git tag "${{ steps.version.outputs.tag_name }}" + git push origin "${{ steps.version.outputs.tag_name }}" + + echo "Created and pushed tag: ${{ steps.version.outputs.tag_name }}" + + - name: Get previous tag for release notes + id: prev_tag + run: | + # Find the previous vscode pre-release tag + PREV_TAG=$(git tag -l "v*-vscode" --sort=-version:refname | head -n 2 | tail -n 1) + + if [ -z "$PREV_TAG" ]; then + echo "No previous tag found, using first commit" + PREV_TAG=$(git rev-list --max-parents=0 HEAD) + fi + + echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT + echo "Previous tag for release notes: $PREV_TAG" + + - name: Create GitHub pre-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Generate release notes between previous tag and current tag + RELEASE_NOTES=$(gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + /repos/${{ github.repository }}/releases/generate-notes \ + -f tag_name="${{ steps.version.outputs.tag_name }}" \ + -f target_commitish="main" \ + -f previous_tag_name="${{ steps.prev_tag.outputs.prev_tag }}" \ + --jq '.body') + + # Create the pre-release + gh release create "${{ steps.version.outputs.tag_name }}" \ + --title "VSCode Pre-release ${{ steps.version.outputs.new_version }}" \ + --notes "$RELEASE_NOTES" \ + --prerelease \ + --target main + + echo "Created pre-release: ${{ steps.version.outputs.tag_name }}" + + - name: Summary + run: | + echo "## VSCode Pre-release Created Successfully! 🚀" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Version Information" >> $GITHUB_STEP_SUMMARY + echo "- **Previous Version:** ${{ steps.version.outputs.previous_version }}" >> $GITHUB_STEP_SUMMARY + echo "- **New Version:** ${{ steps.version.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY + echo "- **Tag:** \`${{ steps.version.outputs.tag_name }}\`" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Links" >> $GITHUB_STEP_SUMMARY + echo "- **PR:** ${{ steps.pr.outputs.pr_url }}" >> $GITHUB_STEP_SUMMARY + echo "- **Release:** https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.tag_name }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Commit" >> $GITHUB_STEP_SUMMARY + echo "- **Base Commit:** \`${{ inputs.main_commit_sha }}\`" >> $GITHUB_STEP_SUMMARY From 2bf202b8c00313756acb8064e9cadab2000024a4 Mon Sep 17 00:00:00 2001 From: Ting-Wai <40179554+tingwai@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:20:15 -0700 Subject: [PATCH 23/42] Apply suggestion from @cubic-dev-ai[bot] Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- .github/workflows/vscode-prerelease.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/vscode-prerelease.yml b/.github/workflows/vscode-prerelease.yml index 3bb67deb2..a2c4b8208 100644 --- a/.github/workflows/vscode-prerelease.yml +++ b/.github/workflows/vscode-prerelease.yml @@ -158,7 +158,7 @@ jobs: done if [ $ELAPSED -ge $TIMEOUT ]; then - echo "Warning: Timed out waiting for PR merge. Please check manually." + echo "Warning: Timed out waiting for PR merge. Please check manually." && exit 1 fi - name: Checkout main branch From fd3d402e9d193348104cc0d3cd3546df9d92030c Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 7 Oct 2025 20:44:22 -0700 Subject: [PATCH 24/42] fix: use session count instead of message count --- gui/src/components/CliInstallBanner.test.tsx | 26 ++++++++++---------- gui/src/components/CliInstallBanner.tsx | 18 +++++++------- gui/src/pages/gui/Chat.tsx | 12 ++++----- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/gui/src/components/CliInstallBanner.test.tsx b/gui/src/components/CliInstallBanner.test.tsx index 5904df50d..134b5aae2 100644 --- a/gui/src/components/CliInstallBanner.test.tsx +++ b/gui/src/components/CliInstallBanner.test.tsx @@ -351,10 +351,10 @@ describe("CliInstallBanner", () => { }); }); - describe("Message threshold logic", () => { - const renderWithMessageCount = async ( - messageCount?: number, - messageThreshold?: number, + describe("Session threshold logic", () => { + const renderWithSessionCount = async ( + sessionCount?: number, + sessionThreshold?: number, ) => { vi.spyOn(mockIdeMessenger.ide, "subprocess").mockResolvedValue([ "", @@ -365,8 +365,8 @@ describe("CliInstallBanner", () => { render( , ), @@ -374,7 +374,7 @@ describe("CliInstallBanner", () => { }; it("shows banner when no threshold is set", async () => { - await renderWithMessageCount(0, undefined); + await renderWithSessionCount(0, undefined); await waitFor(() => { expect( @@ -383,8 +383,8 @@ describe("CliInstallBanner", () => { }); }); - it("does not show banner when message count is below threshold", async () => { - await renderWithMessageCount(2, 3); + it("does not show banner when session count is below threshold", async () => { + await renderWithSessionCount(2, 3); await waitFor(() => { expect( @@ -393,8 +393,8 @@ describe("CliInstallBanner", () => { }); }); - it("shows banner when message count meets threshold", async () => { - await renderWithMessageCount(3, 3); + it("shows banner when session count meets threshold", async () => { + await renderWithSessionCount(3, 3); await waitFor(() => { expect( @@ -403,8 +403,8 @@ describe("CliInstallBanner", () => { }); }); - it("shows banner when message count exceeds threshold", async () => { - await renderWithMessageCount(5, 3); + it("shows banner when session count exceeds threshold", async () => { + await renderWithSessionCount(5, 3); await waitFor(() => { expect( diff --git a/gui/src/components/CliInstallBanner.tsx b/gui/src/components/CliInstallBanner.tsx index a6ceaa312..36662309a 100644 --- a/gui/src/components/CliInstallBanner.tsx +++ b/gui/src/components/CliInstallBanner.tsx @@ -10,17 +10,17 @@ import { RunInTerminalButton } from "./StyledMarkdownPreview/StepContainerPreToo import { Card } from "./ui"; interface CliInstallBannerProps { - /** Current message count - banner shows only if >= messageThreshold */ - messageCount?: number; - /** Minimum messages before showing banner (default: always show) */ - messageThreshold?: number; + /** Number of sessions user has had - banner shows only if >= sessionThreshold */ + sessionCount?: number; + /** Minimum sessions before showing banner (default: always show) */ + sessionThreshold?: number; /** If true, dismissal is permanent via localStorage (default: session only) */ permanentDismissal?: boolean; } export function CliInstallBanner({ - messageCount, - messageThreshold, + sessionCount, + sessionThreshold, permanentDismissal = false, }: CliInstallBannerProps = {}) { const ideMessenger = useContext(IdeMessengerContext); @@ -90,13 +90,13 @@ export function CliInstallBanner({ // - Still loading CLI status // - CLI is already installed // - User has dismissed it - // - Message threshold not met (if threshold is set) + // - Session threshold not met (if threshold is set) if ( cliInstalled === null || cliInstalled === true || dismissed || - (messageThreshold !== undefined && - (messageCount === undefined || messageCount < messageThreshold)) + (sessionThreshold !== undefined && + (sessionCount === undefined || sessionCount < sessionThreshold)) ) { return null; } diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index d0c2f45b4..61fc0a859 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -119,6 +119,9 @@ export function Chat() { const isInEdit = useAppSelector((store) => store.session.isInEdit); const lastSessionId = useAppSelector((state) => state.session.lastSessionId); + const allSessionMetadata = useAppSelector( + (state) => state.session.allSessionMetadata, + ); const hasDismissedExploreDialog = useAppSelector( (state) => state.ui.hasDismissedExploreDialog, ); @@ -381,11 +384,6 @@ export function Chat() { const showScrollbar = showChatScrollbar ?? window.innerHeight > 5000; - // Count user messages for CLI banner threshold - const userMessageCount = useMemo(() => { - return history.filter((item) => item.message.role === "user").length; - }, [history]); - return ( <> {!!showSessionTabs && !isInEdit && } @@ -428,8 +426,8 @@ export function Chat() { /> From d17c521b89e3f7f2d73ae0a8021ba8e5842eeb67 Mon Sep 17 00:00:00 2001 From: Ross Golder Date: Wed, 8 Oct 2025 12:54:30 +0700 Subject: [PATCH 25/42] Update docs/telemetry.mdx Co-authored-by: Ty Dunn --- docs/telemetry.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/telemetry.mdx b/docs/telemetry.mdx index c55d64896..528dbbc5d 100644 --- a/docs/telemetry.mdx +++ b/docs/telemetry.mdx @@ -26,7 +26,7 @@ The following usage information is collected and reported: ## How to Opt Out -### VS Code Extension +### IDE extensions You can disable anonymous telemetry by toggling "Allow Anonymous Telemetry" off in the user settings. From 28da70f1a06872992ae1a44d8a5d9f9b36625317 Mon Sep 17 00:00:00 2001 From: Ross Golder Date: Wed, 8 Oct 2025 12:54:59 +0700 Subject: [PATCH 26/42] Update docs/telemetry.mdx Co-authored-by: Ty Dunn --- docs/telemetry.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/telemetry.mdx b/docs/telemetry.mdx index 528dbbc5d..1e8533cd4 100644 --- a/docs/telemetry.mdx +++ b/docs/telemetry.mdx @@ -30,6 +30,8 @@ The following usage information is collected and reported: You can disable anonymous telemetry by toggling "Allow Anonymous Telemetry" off in the user settings. +#### VS Code + Alternatively in VS Code, you can disable telemetry through your VS Code settings by unchecking the "Continue: Telemetry Enabled" box (this will override the Settings Page settings). VS Code settings can be accessed with `File` > `Preferences` > `Settings` (or use the keyboard shortcut `ctrl` + `,` on Windows/Linux or `cmd` + `,` on macOS). ### CLI From 9e929ce19668309be10c8781bfd324351924787d Mon Sep 17 00:00:00 2001 From: Ross Golder Date: Wed, 8 Oct 2025 12:55:11 +0700 Subject: [PATCH 27/42] Update docs/telemetry.mdx Co-authored-by: Ty Dunn --- docs/telemetry.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/telemetry.mdx b/docs/telemetry.mdx index 1e8533cd4..f71255f0d 100644 --- a/docs/telemetry.mdx +++ b/docs/telemetry.mdx @@ -36,7 +36,7 @@ Alternatively in VS Code, you can disable telemetry through your VS Code setting ### CLI -For the Continue CLI, set the environment variable `CONTINUE_CLI_ENABLE_TELEMETRY=0` before running commands: +For `cn`, the Continue CLI, set the environment variable `CONTINUE_CLI_ENABLE_TELEMETRY=0` before running commands: ```bash export CONTINUE_CLI_ENABLE_TELEMETRY=0 From 0b3ef9be3de3cf40146cbc44794c52e2c2a918dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 09:09:22 +0000 Subject: [PATCH 28/42] chore(deps): bump github/codeql-action from 3 to 4 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v3...v4) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/compliance.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compliance.yaml b/.github/workflows/compliance.yaml index 2a1819fa5..7e44fff65 100644 --- a/.github/workflows/compliance.yaml +++ b/.github/workflows/compliance.yaml @@ -119,12 +119,12 @@ jobs: run: npm audit --audit-level=moderate - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: javascript - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 # Use this for any files that we want to be certain exist # Basically creates a forcing function to discuss were anyone to want to remove them From 29d4967fe5583b8a3fbb30febd13404c082c5bba Mon Sep 17 00:00:00 2001 From: gippole <49358106+gippole@users.noreply.github.com> Date: Wed, 8 Oct 2025 23:20:30 +0900 Subject: [PATCH 29/42] fix: Tables does not rendered correctly #7465 (#8096) refactor: improve table parsing logic and buffer handling in remarkTables (#7465) --- .../utils/remarkTables.tsx | 89 ++++++++++++++----- 1 file changed, 68 insertions(+), 21 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/utils/remarkTables.tsx b/gui/src/components/StyledMarkdownPreview/utils/remarkTables.tsx index db26e4b3f..a8ecc29b6 100644 --- a/gui/src/components/StyledMarkdownPreview/utils/remarkTables.tsx +++ b/gui/src/components/StyledMarkdownPreview/utils/remarkTables.tsx @@ -23,9 +23,34 @@ import { visit } from "unist-util-visit"; export function remarkTables() { return (tree: any) => { visit(tree, "paragraph", (paragraphNode, index, parentOfParagraphNode) => { - let buffer = ""; - visit(paragraphNode, "text", (textNode) => { - buffer += textNode.value; + // Collect all child nodes into a buffer, preserving their types + const buffer: any[] = []; + paragraphNode.children.forEach((child: any) => { + buffer.push(child); + }); + + // Flatten buffer to a string for regex matching, but keep track of positions + let bufferString = ""; + const positions: { start: number; end: number; node: any }[] = []; + + // Recursive renderer for inline nodes -> markdown-ish text + function renderInline(node: any): string { + if (!node) return ""; + if (Array.isArray(node.children)) { + return node.children.map(renderInline).join(""); + } + if (typeof node.value === "string") { + return node.value; + } + return ""; + } + + buffer.forEach((item) => { + const start = bufferString.length; + // renderInline returns a markdown-like string for inline nodes so decorations are preserved + const rendered = renderInline(item); + bufferString += rendered; + positions.push({ start, end: bufferString.length, node: item }); }); const tableRegex = @@ -33,7 +58,7 @@ export function remarkTables() { //// header // newline // |:---|----:| // new line // table rows // prevent modifying if no markdown tables are present - if (!buffer.match(tableRegex)) { + if (!bufferString.match(tableRegex)) { return; } @@ -42,7 +67,7 @@ export function remarkTables() { const newNodes = []; let failed = false; - while ((match = tableRegex.exec(buffer)) !== null) { + while ((match = tableRegex.exec(bufferString)) !== null) { const fullTableString = match[0]; const headerGroup = match[1]; const separatorGroup = match[2]; @@ -104,16 +129,46 @@ export function remarkTables() { ], }; - // Add any text before the table as a text node - if (match.index > lastIndex) { - newNodes.push({ - type: "text", - value: buffer.slice(lastIndex, match.index), - }); - } + // Add any nodes before/after the table in one go + const tableStart = match.index; + const tableEnd = match.index + fullTableString.length; - // Add table node + // Process the text within the table and the surrounding text together + const beforeNodes: any[] = []; + const afterNodes: any[] = []; + + positions.forEach((pos) => { + if (pos.end <= tableStart) { + beforeNodes.push(pos.node); + } else if (pos.start >= tableEnd) { + afterNodes.push(pos.node); + } else if (pos.node.type === "text") { + // Node is text and overlaps with table, may need splitting + const beforeText = pos.node.value.slice( + 0, + Math.max(0, tableStart - pos.start), + ); + const afterText = pos.node.value.slice( + Math.max(0, tableEnd - pos.start), + ); + if (beforeText) + beforeNodes.push({ type: "text", value: beforeText }); + if (afterText) + afterNodes.push({ type: "text", value: afterText }); + } else { + // Node overlaps with table but isn't text (e.g., inlineCode, emphasis, etc.) + if (pos.start < tableStart) beforeNodes.push(pos.node); + if (pos.end > tableEnd) afterNodes.push(pos.node); + } + }); + + // Add to new nodes + newNodes.push(...beforeNodes); newNodes.push(tableNode); + newNodes.push(...afterNodes); + + // Mark positions as consumed + positions.length = 0; } catch (e) { console.error("Failed to parse markdown table after regex match", e); newNodes.push({ @@ -129,14 +184,6 @@ export function remarkTables() { return; } - // Add any remaining text after the last table - if (lastIndex < buffer.length) { - newNodes.push({ - type: "text", - value: buffer.slice(lastIndex), - }); - } - // Replace the original paragraph node with the new nodes if (newNodes.length > 0) { parentOfParagraphNode.children.splice(index, 1, ...newNodes); From 03598ea26ddd7c1e576aef0c12c005d68890a6f4 Mon Sep 17 00:00:00 2001 From: Mark Espinoza Date: Wed, 8 Oct 2025 09:23:06 -0500 Subject: [PATCH 30/42] fix: LLM Provider - Ask Sage: Updated Model list, updated docs and fixed drop down menu option (#8102) * feat: enhance AskSage with new request handling and token management * feat: update provider options and add new Ask Sage models * feat: update Ask Sage model configurations and remove deprecated API Base URL input * feat: update package versions and add @anthropic-ai/sdk dependency * feat: update model titles and modify API base URL handling in provider configuration * feat: update Ask Sage documentation and add to navigation * Update gui/src/pages/AddNewModel/configs/providers.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- core/llm/llms/Asksage.ts | 381 ++++++++++++---- .../model-providers/more/asksage.mdx | 123 +++-- docs/docs.json | 1 + extensions/vscode/package-lock.json | 5 +- gui/package-lock.json | 3 +- gui/src/pages/AddNewModel/configs/models.ts | 422 +++++++++++++++--- .../pages/AddNewModel/configs/providers.ts | 55 ++- 7 files changed, 786 insertions(+), 204 deletions(-) diff --git a/core/llm/llms/Asksage.ts b/core/llm/llms/Asksage.ts index 988c57ac6..93d2016c3 100644 --- a/core/llm/llms/Asksage.ts +++ b/core/llm/llms/Asksage.ts @@ -1,3 +1,4 @@ +import FormData from "form-data"; import { ChatMessage, CompletionOptions, @@ -6,48 +7,169 @@ import { } from "../../index.js"; import { BaseLLM } from "../index.js"; +// Extended options for AskSage +interface AskSageCompletionOptions extends CompletionOptions { + mode?: "chat" | "deep_agent"; + limitReferences?: 0 | 1; + persona?: number; + systemPrompt?: string; + askSageTools?: AskSageTool[]; + enabledMcpTools?: string[]; + toolsToExecute?: string[]; + askSageToolChoice?: ToolChoice; + reasoningEffort?: "low" | "medium" | "high"; + deepAgentId?: number; + streaming?: boolean; + file?: unknown; +} + +const DEFAULT_API_URL = "https://api.asksage.ai/server"; +const DEFAULT_USER_API_URL = "https://api.asksage.ai/user"; +const TOKEN_TTL = 3600000; // 1 hour in milliseconds + +interface AskSageTool { + type: string; + function: { + name: string; + description?: string; + parameters?: Record; + }; +} + +type ToolChoice = + | "auto" + | "none" + | { type: "function"; function: { name: string } }; + +interface AskSageRequestArgs { + model?: string; + temperature?: number; + mode?: "chat" | "deep_agent"; + message?: string | { user: string; message: string }[]; + live?: 0 | 1 | 2; + dataset?: string | string[]; + limit_references?: 0 | 1; + persona?: number; + system_prompt?: string; + tools?: AskSageTool[]; + enabled_mcp_tools?: string[]; + tools_to_execute?: string[]; + tool_choice?: ToolChoice; + reasoning_effort?: "low" | "medium" | "high"; + deep_agent_id?: number; + streaming?: boolean; + file?: unknown; +} + +interface AskSageResponse { + text?: string; + answer?: string; + message?: string; + status?: number | string; + response?: unknown; + choices?: Array<{ + message?: { + content?: string; + }; + }>; +} + +interface TokenResponse { + status: number | string; + response: { + access_token: string; + }; +} + class Asksage extends BaseLLM { static providerName = "askSage"; static defaultOptions: Partial = { - apiBase: "https://api.asksage.ai/server/", + apiBase: DEFAULT_API_URL, model: "gpt-4o", }; - private static modelConversion: { [key: string]: string } = { - "gpt-4o-gov": "gpt-4o-gov", // Works - "gpt-4o-mini-gov": "gpt-4o-mini-gov", - "gpt4-gov": "gpt4-gov", // Works - "gpt-gov": "gpt-gov", // Works - "gpt-4o": "gpt-4o", // Works - "gpt-4o-mini": "gpt-4o-mini", // Works - gpt4: "gpt4", // Works - "gpt4-32k": "gpt4-32k", - "gpt-o1": "gpt-o1", // Works - "gpt-o1-mini": "gpt-o1-mini", // Works - "gpt-o3-mini": "gpt-o3-mini", // Stub - "gpt-3.5-turbo": "gpt35-16k", // Works - "aws-bedrock-claude-35-sonnet-gov": "aws-bedrock-claude-35-sonnet-gov", // Works - "claude-3-5-sonnet-latest": "claude-35-sonnet", // Works - "claude-3-opus-20240229": "claude-3-opus", // Works - "claude-3-sonnet-20240229": "claude-3-sonnet", // Works - "grok-beta": "xai-grok", - "groq-llama33": "groq-llama33", - "groq-70b": "groq-70b", - "mistral-large-latest": "mistral-large", // Works - "llama3-70b": "llma3", // Works - "gemini-1.5-pro-latest": "google-gemini-pro", // Works - }; + private sessionTokenPromise: Promise | null = null; + private tokenTimestamp: number = 0; + private email?: string; + private userApiUrl: string; constructor(options: LLMOptions) { super(options); this.apiVersion = options.apiVersion ?? "v1.2.4"; + this.email = process.env.ASKSAGE_EMAIL; + this.userApiUrl = process.env.ASKSAGE_USER_API_URL || DEFAULT_USER_API_URL; } - protected _convertModelName(model: string): string { - console.log("Converting model:", model); - const convertedModel = Asksage.modelConversion[model] ?? model; - console.log("Converted model:", convertedModel); - return convertedModel; + private async getSessionToken(): Promise { + if (!this.apiKey) { + throw new Error( + "AskSage adapter: missing ASKSAGE_API_KEY. Provide it in your environment variables or .env file.", + ); + } + + // If no email, use API key directly + if (!this.email || this.email.length === 0) { + return this.apiKey; + } + + const url = this.userApiUrl.replace(/\/$/, "") + "/get-token-with-api-key"; + const res = await this.fetch(url, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ email: this.email, api_key: this.apiKey }), + }); + + const data = (await res.json()) as TokenResponse; + if (parseInt(String(data.status)) !== 200) { + throw new Error("Error getting access token: " + JSON.stringify(data)); + } + return data.response.access_token; + } + + private async getToken(): Promise { + // Check if token needs refresh + if ( + !this.sessionTokenPromise || + Date.now() - this.tokenTimestamp > TOKEN_TTL + ) { + this.sessionTokenPromise = this.getSessionToken(); + this.tokenTimestamp = Date.now(); + } + return this.sessionTokenPromise; + } + + private isFileLike(val: unknown): boolean { + return ( + val !== null && + val !== undefined && + ((typeof File !== "undefined" && val instanceof File) || + (typeof Buffer !== "undefined" && val instanceof Buffer) || + (typeof val === "object" && + ("path" in val || "name" in val || "type" in val))) + ); + } + + private toFormData(args: AskSageRequestArgs): FormData { + const form = new FormData(); + + for (const [key, value] of Object.entries(args)) { + if (value === undefined || value === null) continue; + + if (key === "file" && value) { + if (Buffer.isBuffer(value)) { + form.append("file", value, "file"); + } else if (typeof value === "string") { + form.append("file", value); + } else { + form.append("file", value as Buffer); + } + } else if (Array.isArray(value) || typeof value === "object") { + form.append(key, JSON.stringify(value)); + } else { + form.append(key, String(value)); + } + } + return form; } protected _convertMessage(message: ChatMessage) { @@ -63,43 +185,63 @@ class Asksage extends BaseLLM { }; } - protected _convertArgs(options: any, messages: ChatMessage[]) { - let formattedMessage: any; + protected _convertArgs( + options: AskSageCompletionOptions, + messages: ChatMessage[], + ): AskSageRequestArgs { + let formattedMessage: string | { user: string; message: string }[]; if (messages.length === 1) { - formattedMessage = messages[0].content; + formattedMessage = messages[0].content as string; } else { formattedMessage = messages.map(this._convertMessage); } - const args: any = { + const args: AskSageRequestArgs = { message: formattedMessage, - persona: options.persona ?? "default", - dataset: options.dataset ?? "none", - limit_references: options.limitReferences ?? 0, + model: options.model, temperature: options.temperature ?? 0.0, - live: options.live ?? 0, - model: this._convertModelName(options.model), + mode: "chat", // Always use chat mode + limit_references: 0, // Always use 0 + persona: options.persona as number | undefined, system_prompt: options.systemPrompt ?? + process.env.ASKSAGE_SYSTEM_PROMPT ?? "You are an expert software developer. You give helpful and concise responses.", - tools: options.tools, - tool_choice: options.toolChoice, + tools: options.askSageTools, + // enabled_mcp_tools: options.enabledMcpTools as string[] | undefined, + // tools_to_execute: options.toolsToExecute as string[] | undefined, + tool_choice: options.askSageToolChoice, + reasoning_effort: options.reasoningEffort as + | "low" + | "medium" + | "high" + | undefined, + deep_agent_id: options.deepAgentId as number | undefined, + streaming: options.streaming as boolean | undefined, + file: options.file, }; + // Remove undefined values Object.keys(args).forEach( - (key) => args[key] === undefined && delete args[key], + (key) => + args[key as keyof AskSageRequestArgs] === undefined && + delete args[key as keyof AskSageRequestArgs], ); return args; } - protected _getHeaders() { + protected async _getHeaders( + hasFile: boolean = false, + ): Promise> { + const token = await this.getToken(); const headers: Record = { - "Content-Type": "application/json", + accept: "application/json", + "x-access-tokens": token, }; - if (this.apiKey) { - headers["x-access-tokens"] = this.apiKey; + if (!hasFile) { + headers["Content-Type"] = "application/json"; } return headers; @@ -125,21 +267,66 @@ class Asksage extends BaseLLM { } const messages: ChatMessage[] = [{ role: "user", content: prompt }]; - const args = this._convertArgs(options, messages); + const hasFile = this.isFileLike(args.file); + const endpoint = hasFile ? "query_with_file" : "query"; - const response = await this.fetch(this._getEndpoint("query"), { - method: "POST", - headers: this._getHeaders(), - body: JSON.stringify(args), - }); + try { + let response; + if (hasFile) { + const form = this.toFormData(args); + const headers = await this._getHeaders(true); + response = await this.fetch(this._getEndpoint(endpoint), { + method: "POST", + headers: { + ...headers, + ...form.getHeaders(), + }, + body: form as unknown as BodyInit, + signal, + }); + } else { + const headers = await this._getHeaders(false); + response = await this.fetch(this._getEndpoint(endpoint), { + method: "POST", + headers, + body: JSON.stringify(args), + signal, + }); + } - if (response.status === 499) { - return ""; // Aborted by user + if (response.status === 499) { + return ""; // Aborted by user + } + + if (!response.ok) { + const errText = await response.text(); + + // Clear token cache on 401 + if (response.status === 401) { + this.sessionTokenPromise = null; + this.tokenTimestamp = 0; + } + + throw new Error( + `AskSage API error: ${response.status} ${response.statusText}: ${errText}`, + ); + } + + const data = (await response.json()) as AskSageResponse; + return ( + data.text || + data.answer || + data.message || + data.choices?.[0]?.message?.content || + "" + ); + } catch (error) { + if (error instanceof Error) { + throw new Error(`AskSage client error: ${error.message}`); + } + throw error; } - - const data = await response.json(); - return data.message; } protected async *_streamComplete( @@ -157,30 +344,74 @@ class Asksage extends BaseLLM { options: CompletionOptions, ): AsyncGenerator { const args = this._convertArgs(options, messages); + const hasFile = this.isFileLike(args.file); + const endpoint = hasFile ? "query_with_file" : "query"; - const response = await this.fetch(this._getEndpoint("query"), { - method: "POST", - headers: this._getHeaders(), - body: JSON.stringify(args), - signal, - }); + try { + let response; + if (hasFile) { + const form = this.toFormData(args); + const headers = await this._getHeaders(true); + response = await this.fetch(this._getEndpoint(endpoint), { + method: "POST", + headers: { + ...headers, + ...form.getHeaders(), + }, + body: form as unknown as BodyInit, + signal, + }); + } else { + const headers = await this._getHeaders(false); + response = await this.fetch(this._getEndpoint(endpoint), { + method: "POST", + headers, + body: JSON.stringify(args), + signal, + }); + } - if (response.status === 499) { - return; // Aborted by user + if (response.status === 499) { + return; // Aborted by user + } + + if (!response.ok) { + const errText = await response.text(); + + // Clear token cache on 401 + if (response.status === 401) { + this.sessionTokenPromise = null; + this.tokenTimestamp = 0; + } + + throw new Error( + `AskSage API error: ${response.status} ${response.statusText}: ${errText}`, + ); + } + + const data = (await response.json()) as AskSageResponse; + + const assistantMessage: ChatMessage = { + role: "assistant", + content: + data.text || + data.answer || + data.message || + data.choices?.[0]?.message?.content || + "", + }; + + yield assistantMessage; + } catch (error) { + if (error instanceof Error) { + throw new Error(`AskSage client error: ${error.message}`); + } + throw error; } - - const data = await response.json(); - - const assistantMessage: ChatMessage = { - role: "assistant", - content: data.message, - }; - - yield assistantMessage; } async listModels(): Promise { - return Object.keys(Asksage.modelConversion); + return []; } } diff --git a/docs/customize/model-providers/more/asksage.mdx b/docs/customize/model-providers/more/asksage.mdx index 03ad0e3ca..c7dd81391 100644 --- a/docs/customize/model-providers/more/asksage.mdx +++ b/docs/customize/model-providers/more/asksage.mdx @@ -1,18 +1,34 @@ --- -title: "AskSage" -description: "Configure AskSage with Continue to access a wide range of models including government-compliant versions of GPT and Claude models, supporting chat and edit functionalities" +title: "Ask Sage" +slug: ../asksage --- + + **Discover Ask Sage models [here](https://hub.continue.dev/?q=Ask%20Sage)** + + - To get an Ask Sage API key login to the Ask Sage platform (If you don't have - an account, you can create one [here](https://chat.asksage.ai/)) and follow - the instructions in the Ask Sage Docs: [Ask Sage API - Key](https://docs.asksage.ai/docs/api-documentation/api-documentation.html) + You can get an API key from the [Ask Sage](https://www.asksage.ai/). -## Configuration -To use the Ask Sage models, you can use the following +## Overview + +Ask Sage provides secure, government-compliant access to LLMs. This guide explains how to set up and configure Ask Sage models, including support for DoD certificates. + +## 1. Prerequisites + +- **Ask Sage Account:** + Sign up or log in at [Ask Sage Platform](https://chat.asksage.ai/). + +- **API Key:** + Follow the [API Key Documentation](https://docs.asksage.ai/docs/api-documentation/api-documentation.html) to generate your key. + + +## 2. Configuration + +Add your Ask Sage model to your Continue configuration file. + @@ -42,53 +58,66 @@ To use the Ask Sage models, you can use the following -The `apiBase` will be listed on the Ask Sage platform when you generate an `API key`. You will see context as shown below: +## 3. Using DoD Certificates -> Server API for query/training etc.: -> -> - Documentation: https://app.swaggerhub.com/apis-docs/NICOLASCHAILLAN_1/server_ask-sage_api/1.0 -> - URL for this API is: https://api.asksage.ai/server/ +For secure environments, specify your DoD CA bundle path: -## Usage -Currently, the setup for the models provided by Ask Sage is to support the following two functionalities provided by Continue.Dev: + + + ```yaml title="config.yaml" + models: + - name: GPT-4 gov + provider: askSage + model: gpt4-gov + apiBase: https://api.asksage.ai/server/ + apiKey: + requestOptions: + caBundlePath: /path/to/dod/certificates + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "GPT-4 gov", + "provider": "askSage", + "model": "gpt4-gov", + "apiBase": "https://api.asksage.ai/server/", + "apiKey": "", + "requestOptions": { + "caBundlePath": "/path/to/dod/certificates" + } + } + ] + } + ``` + + -- `Chat` to understand and iterate on code in the sidebar -- `Edit` to modify code without leaving your current file +Replace `/path/to/dod/certificates` with your actual CA bundle file path. -More models, functionalities and documentation will be added in the future for Ask Sage Integration. +--- -> We recommend to utilize the `OpenAI` or `Anthropic` models for the best performance and results for the `Chat` and `Edit` functionalities. +## 4. Final Steps -## Ask Sage Documentation +- Save your configuration file. +- Restart Continue to apply changes. -Ask Sage documentation is not available with Continue.Dev, so if you have any questions or need help with Ask Sage type `@ask` and select the `Ask Sage` option in the chat. Then procced to ask your question about Ask Sage. +Your Ask Sage model will now be available in Continue. -## Current Models From Ask Sage Supported +## 5. Usage -The current Models available provided by Ask Sage are: +Supported features: + +- **Chat:** Interact and iterate on code in the sidebar. +- **Edit:** Modify code in place. + +## 6. Support + +- Refer to [Ask Sage Docs](https://docs.asksage.ai/docs/api-documentation/api-documentation.html) for more details. +- Email the Ask Sage support team for assistance at support@asksage.ai. + +--- -| Index | Model | Added | -| ----- | --------------------- | ----- | -| 1 | GPT-4 Gov | ✅ | -| 2 | GPT-4o Gov | ✅ | -| 3 | GPT-4o-mini Gov | ✅ | -| 4 | GPT-3.5-Turbo Gov | ✅ | -| 5 | GPT-4o | ✅ | -| 6 | GPT-4o-mini | ✅ | -| 7 | GPT-4 | ✅ | -| 8 | GPT-4-32K | ✅ | -| 9 | GPT-o1 | ✅ | -| 10 | GPT-o1-mini | ✅ | -| 10 | GPT-o3-mini | ✅ | -| 11 | GPT-3.5-turbo | ✅ | -| 12 | Claude 3.5 Sonnet Gov | ✅ | -| 13 | Claude 3 Opus | ✅ | -| 14 | Claude 3 Sonet | ✅ | -| 15 | Claude 3.5 Sonnet | ✅ | -| 16 | Grok (xAI) | ✅ | -| 17 | Groq Llama 3.3 | ✅ | -| 18 | Groq 70B | ✅ | -| 19 | Gemini Pro | ✅ | -| 20 | llama 3 | ✅ | -| 21 | Mistral Large | ✅ | diff --git a/docs/docs.json b/docs/docs.json index 04e9b809b..27282b5d7 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -135,6 +135,7 @@ { "group": "More Providers", "pages": [ + "customize/model-providers/more/asksage", "customize/model-providers/more/deepseek", "customize/model-providers/more/deepinfra", "customize/model-providers/more/groq", diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index eaa07b5a0..47283ebf1 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.3.12", + "version": "1.3.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.3.12", + "version": "1.3.15", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "file:../../packages/config-types", @@ -100,6 +100,7 @@ "version": "1.1.0", "license": "Apache-2.0", "dependencies": { + "@anthropic-ai/sdk": "^0.62.0", "@aws-sdk/client-bedrock-runtime": "^3.779.0", "@aws-sdk/client-sagemaker-runtime": "^3.777.0", "@aws-sdk/credential-providers": "^3.778.0", diff --git a/gui/package-lock.json b/gui/package-lock.json index 962b06471..1796d1ab7 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -116,6 +116,7 @@ "version": "1.1.0", "license": "Apache-2.0", "dependencies": { + "@anthropic-ai/sdk": "^0.62.0", "@aws-sdk/client-bedrock-runtime": "^3.779.0", "@aws-sdk/client-sagemaker-runtime": "^3.777.0", "@aws-sdk/credential-providers": "^3.778.0", @@ -235,7 +236,7 @@ }, "../packages/config-yaml": { "name": "@continuedev/config-yaml", - "version": "1.14.0", + "version": "1.23.0", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index 76151a274..aaa8092f7 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -514,7 +514,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 8192, }, icon: "meta.png", - providerOptions: ["groq", "askSage"], + providerOptions: ["groq"], isOpenSource: false, }, llama318bChat: { @@ -841,7 +841,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 32000, }, icon: "mistral.png", - providerOptions: ["mistral", "askSage"], + providerOptions: ["mistral"], isOpenSource: false, }, mistralNemo: { @@ -1114,7 +1114,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 128_000, title: "GPT-4o", }, - providerOptions: ["openai", "askSage"], + providerOptions: ["openai"], icon: "openai.png", isOpenSource: false, }, @@ -1125,9 +1125,10 @@ export const models: { [key: string]: ModelPackage } = { params: { model: "gpt-4o-mini", contextLength: 128_000, + title: "GPT-4o mini", }, - providerOptions: ["openai", "askSage"], + providerOptions: ["openai"], icon: "openai.png", isOpenSource: false, }, @@ -1140,7 +1141,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 8096, title: "GPT-3.5-Turbo", }, - providerOptions: ["openai", "askSage"], + providerOptions: ["openai"], icon: "openai.png", isOpenSource: false, }, @@ -1154,7 +1155,7 @@ export const models: { [key: string]: ModelPackage } = { title: "Claude 4 Sonnet", apiKey: "", }, - providerOptions: ["anthropic", "askSage"], + providerOptions: ["anthropic"], icon: "anthropic.png", isOpenSource: false, }, @@ -1167,7 +1168,7 @@ export const models: { [key: string]: ModelPackage } = { title: "Claude 4.1 Opus", apiKey: "", }, - providerOptions: ["anthropic", "askSage"], + providerOptions: ["anthropic"], icon: "anthropic.png", isOpenSource: false, }, @@ -1331,135 +1332,382 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["vertexai"], isOpenSource: false, }, + // OpenAI Models via Ask Sage + asksagegpt4o: { + title: "GPT-4o*", + description: + "An even faster version of GPT-4 with stronger multi-modal capabilities.", + params: { + model: "gpt-4o", + contextLength: 128_000, + maxTokens: 16_384, + title: "GPT-4o*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "openai.png", + isOpenSource: false, + }, + asksagegpt4omini: { + title: "GPT-4o Mini*", + description: + "A model at less than half the price of gpt-3.5-turbo, but near gpt-4 in capabilities.", + params: { + model: "gpt-4o-mini", + contextLength: 128_000, + maxTokens: 16_384, + title: "GPT-4o mini*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "openai.png", + isOpenSource: false, + }, asksagegpt4gov: { - title: "GPT-4 gov", + title: "GPT-4 gov*", description: "U.S. Government. Most capable model today - which is similar to GPT-4 but approved for use by the U.S. Government.", params: { model: "gpt4-gov", contextLength: 128_000, - title: "GPT-4 gov", + maxTokens: 4096, + title: "GPT-4 gov*", + apiKey: "", }, providerOptions: ["askSage"], icon: "openai.png", isOpenSource: false, }, asksagegpt4ogov: { - title: "GPT-4o gov", + title: "GPT-4o gov*", description: "U.S. Government. Most capable model today - which is similar to GPT-4o but approved for use by the U.S. Government.", params: { model: "gpt-4o-gov", contextLength: 128_000, - title: "GPT-4o-gov", + maxTokens: 4096, + title: "GPT-4o-gov*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "openai.png", + isOpenSource: false, + }, + asksagegpt35: { + title: "GPT-3.5*", + description: "Azure OpenAI GPT 3.5 Model.", + params: { + model: "gpt", + contextLength: 4096, + title: "GPT-3.5*", + apiKey: "", }, providerOptions: ["askSage"], icon: "openai.png", isOpenSource: false, }, asksagegpt35gov: { - title: "GPT-3.5-Turbo gov", + title: "GPT-3.5 gov*", description: "U.S. Government. Inexpensive and good ROI.", params: { model: "gpt-gov", - contextLength: 8096, - title: "GPT-3.5-Turbo gov", + contextLength: 16834, + maxTokens: 4096, + title: "GPT-3.5 gov*", + apiKey: "", }, providerOptions: ["askSage"], icon: "openai.png", isOpenSource: false, }, asksagegpt4ominigov: { - title: "GPT-4o-mini gov", - description: - "U.S. Government. Latest OpenAI GPT 4o-mini model. More inexpensive than GPT4. Capable of ingesting and analyzing images (JPG, PNG, GIF (20MB files max)). 16,384 token response max.", + title: "GPT-4o-mini gov*", + description: "OpenAI GPT 4o-mini model.", params: { model: "gpt-4o-mini-gov", contextLength: 128_000, - title: "GPT-4o-mini gov", + maxTokens: 16_384, + title: "GPT-4o-mini gov*", + apiKey: "", }, providerOptions: ["askSage"], icon: "openai.png", isOpenSource: false, }, asksagegpt4: { - title: "GPT-4", + title: "GPT-4*", description: "GPT4 is about 5X more expensive than Ask Sage tokens and 50X more expensive than GPT3.5", params: { model: "gpt4", contextLength: 8_192, - title: "GPT-4", - }, - providerOptions: ["openai"], - icon: "openai.png", - isOpenSource: false, - }, - asksagegpt432: { - title: "GPT-4-32k", - description: - "The GPT-4-32k model is a variant of the GPT-4 model developed by OpenAI. It is designed to handle a larger context window, capable of processing up to 32,768 tokens, which makes it suitable for scenarios that require extensive information integration and data analysis", - params: { - model: "gpt4-32k", - contextLength: 32_768, - title: "GPT-4-32k", + title: "GPT-4*", + apiKey: "", }, providerOptions: ["openai"], icon: "openai.png", isOpenSource: false, }, asksagegpto1: { - title: "GPT-o1", + title: "GPT-o1*", description: "Latest OpenAI GPT-o1 model. More inexpensive than GPT4. Capable of ingesting and analyzing images (JPG, PNG, GIF (20MB files max)).", params: { model: "gpt-o1", contextLength: 128_000, - title: "GPT-o1", + maxTokens: 32_768, + title: "GPT-o1*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "openai.png", + isOpenSource: false, // stopped here + }, + asksagegpt41: { + title: "GPT-4.1*", + description: "Azure OpenAI GPT 4.1 model.", + params: { + model: "gpt-4.1", + contextLength: 1_000_000, + maxTokens: 32_768, + title: "GPT-4.1*", + apiKey: "", }, providerOptions: ["askSage"], icon: "openai.png", isOpenSource: false, }, - asksagegpto1mini: { - title: "GPT-o1-mini", - description: - "Latest OpenAI GPT-o1-mini model. More inexpensive than GPT-o1. Capable of ingesting and analyzing images (JPG, PNG, GIF (20MB files max)). 16,384 token response max.", + asksagegpt41mini: { + title: "GPT-4.1 mini*", + description: "Azure OpenAI GPT 4.1 mini model.", params: { - model: "gpt-o1-mini", - contextLength: 128_000, - title: "GPT-o1-mini", + model: "gpt-4.1-mini", + contextLength: 1_000_000, + maxTokens: 32_768, + title: "GPT-4.1 mini*", + apiKey: "", }, providerOptions: ["askSage"], icon: "openai.png", isOpenSource: false, }, - asksagegpto3mini: { - title: "GPT-o3-mini", - description: - "o3-mini can outperform o1 in coding and other reasoning tasks, and is 93% cheaper and has lower latency. It supports function calling, Structured Outputs, streaming, and developer messages. o3-mini comes with a larger context window of 200,000 tokens and a max output of 100,000 tokens", + asksagegpt41nano: { + title: "GPT-4.1 nano*", + description: "Azure OpenAI GPT 4.1 nano model.", params: { - model: "gpt-o3-mini", + model: "gpt-4.1-nano", + contextLength: 1_000_000, + maxTokens: 32_768, + title: "GPT-4.1 nano*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "openai.png", + isOpenSource: false, + }, + asksagegpt5: { + title: "GPT-5*", + description: "OpenAI's GPT-5 model", + params: { + model: "gpt-5", + contextLength: 272_000, + maxTokens: 128_000, + title: "GPT-5*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "openai.png", + isOpenSource: false, + }, + asksagegpt5nano: { + title: "GPT-5-nano*", + description: "OpenAI's GPT-5-nano model", + params: { + model: "gpt-5-nano", + contextLength: 272_000, + maxTokens: 128_000, + title: "GPT-5-nano*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "openai.png", + isOpenSource: false, + }, + asksagegpt5mini: { + title: "GPT-5-mini*", + description: "OpenAI's GPT-5-mini model", + params: { + model: "gpt-5-mini", + contextLength: 272_000, + maxTokens: 128_000, + title: "GPT-5-mini*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "openai.png", + isOpenSource: false, + }, + asksagegpto3: { + title: "GPT-o3", + description: "Azure OpenAI GPT o3 model.", + params: { + model: "gpt-o3", contextLength: 200_000, - title: "GPT-o3-mini", + maxTokens: 100_000, + title: "GPT-o3", + apiKey: "", }, providerOptions: ["askSage"], icon: "openai.png", isOpenSource: false, }, - asksageclaude35gov: { - title: "Claude 3.5 Sonnet gov", + asksagegpt04mini: { + title: "GPT-o4-mini", + description: "Azure OpenAI GPT o4-mini model.", + params: { + model: "gpt-o4-mini", + contextLength: 200_000, + maxTokens: 100_000, + title: "GPT-o4-mini", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "openai.png", + isOpenSource: false, + }, + asksageclaude35Sonnet: { + title: "Claude 3.5 Sonnet", description: "Anthropic's most intelligent model, but much less expensive than Claude 3 Opus", params: { - model: "aws-bedrock-claude-35-sonnet-gov", + model: "claude-35-sonnet", contextLength: 200_000, - title: "Claude 3.5 Sonnet gov", + title: "Claude 3.5 Sonnet", + apiKey: "", }, providerOptions: ["askSage"], icon: "anthropic.png", isOpenSource: false, }, + asksageclaude37sonnet: { + title: "Claude 3.7 Sonnet", + description: "Anthropic's 3.7 model.", + params: { + model: "claude-37-sonnet", + contextLength: 200_000, + title: "Claude 3.7 Sonnet", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "anthropic.png", + isOpenSource: false, + }, + asksageclaude37sonnetgov: { + title: "Claude 3.7 Sonnet gov*", + description: "Anthropic's 3.7 Sonnet model.", + params: { + model: "aws-bedrock-claude-37-sonnet-gov", + contextLength: 200_000, + title: "Claude 3.7 Sonnet gov*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "anthropic.png", + isOpenSource: false, + }, + asksageclaude35gov: { + title: "Claude 3.5 Sonnet gov*", + description: "Anthropic's 3.5 Sonnet model.", + params: { + model: "aws-bedrock-claude-35-sonnet-gov", + contextLength: 200_000, + title: "Claude 3.5 Sonnet gov*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "anthropic.png", + isOpenSource: false, + }, + asksageclaude4s: { + title: "Claude 4 Sonnet", + description: "Anthropic's Claude 4 Sonnet", + params: { + model: "claude-4-sonnet", + contextLength: 200_000, + title: "Claude 4 Sonnet", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "anthropic.png", + isOpenSource: false, + }, + asksageclaude4o: { + title: "Claude 4 Opus", + description: "Anthropic's Claude 4 Opus", + params: { + model: "claude-4-opus", + contextLength: 200_000, + title: "Claude 4 Opus", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "anthropic.png", + isOpenSource: false, + }, + asksageclaude4sonnet: { + title: "Claude 4 Sonnet*", + description: + "Anthropic's most powerful model, designed for complex, reasoning-heavy tasks like agentic search, coding, and writing.", + params: { + model: "google-claude-4-sonnet", + contextLength: 200_000, + title: "Claude 4 Sonnet*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "anthropic.png", + isOpenSource: false, + }, + asksageclaude45sonnet: { + title: "Claude 4.5 Sonnet*", + description: + "Anthropic's most powerful model, designed for complex, reasoning-heavy tasks like agentic search, coding, and writing.", + params: { + model: "google-claude-45-sonnet", + contextLength: 200_000, + title: "Claude 4.5 Sonnet*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "anthropic.png", + isOpenSource: false, + }, + asksageclaude41opus: { + title: "Claude 4.1 Opus*", + description: "Claude 4.1 Opus", + params: { + model: "google-claude-4-opus", + contextLength: 200_000, + title: "Claude 4.1 Opus*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "anthropic.png", + isOpenSource: false, + }, + asksagenovalite: { + title: "Nova Lite*", + description: "AWS Gov Nova Lite model.", + params: { + model: "aws-bedrock-nova-lite-gov", + contextLength: 300_000, + title: "Nova Lite*", + apiKey: "", + }, + providerOptions: ["askSage"], + icon: "aws.png", + isOpenSource: false, + }, asksagegroqllama33: { title: "Llama 3.3", description: "Llama-3.3 is a large language model customized by Groq.", @@ -1467,7 +1715,9 @@ export const models: { [key: string]: ModelPackage } = { title: "Llama 3.3", model: "groq-llama33", contextLength: 128_000, + apiKey: "", }, + providerOptions: ["askSage"], icon: "groq.png", isOpenSource: true, }, @@ -1478,10 +1728,66 @@ export const models: { [key: string]: ModelPackage } = { title: "Groq-70B", model: "groq-70b", contextLength: 8_192, + apiKey: "", }, + providerOptions: ["askSage"], icon: "groq.png", isOpenSource: true, }, + asksagegemini20Flash: { + title: "Gemini 2.0 Flash*", + description: + "Google's powerful workhorse model with low latency and enhanced performance.", + params: { + title: "Gemini 2.0 Flash*", + model: "google-gemini-20-flash", + contextLength: 1_000_000, + apiKey: "", + }, + icon: "gemini.png", + providerOptions: ["askSage"], + isOpenSource: false, + }, + asksagegemini25Pro: { + title: "Gemini 2.5 Pro*", + description: "Google's Gemini 2.5 Pro model", + params: { + title: "Gemini 2.5 Pro*", + model: "google-gemini-2.5-pro", + contextLength: 1_000_000, + apiKey: "", + }, + icon: "gemini.png", + providerOptions: ["askSage"], + isOpenSource: false, + }, + asksagegemini25flash: { + title: "Gemini 2.5 Flash*", + description: "Google's Gemini 2.5 Flash model", + params: { + title: "Gemini 2.5 Flash*", + model: "google-gemini-2.5-flash", + contextLength: 1_000_000, + apiKey: "", + }, + icon: "gemini.png", + providerOptions: ["askSage"], + isOpenSource: false, + }, + asksagegrok4: { + title: "Grok 4", + description: + "xAI's latest and greatest flagship model, offering strong performance in natural language, math and reasoning.", + params: { + title: "Grok 4", + model: "xai-grok", + contextLength: 256_000, + apiKey: "", + }, + icon: "xAI.png", + providerOptions: ["askSage"], + isOpenSource: false, + }, Qwen2Coder: { title: "Qwen 2.5 Coder 7b", description: @@ -1531,7 +1837,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 256000, }, icon: "xAI.png", - providerOptions: ["xAI", "askSage"], + providerOptions: ["xAI"], isOpenSource: false, }, grok4FastReasoning: { @@ -1544,7 +1850,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 2_000_000, }, icon: "xAI.png", - providerOptions: ["xAI", "askSage"], + providerOptions: ["xAI"], isOpenSource: false, }, grok4FastNonReasoning: { @@ -1557,7 +1863,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 2_000_000, }, icon: "xAI.png", - providerOptions: ["xAI", "askSage"], + providerOptions: ["xAI"], isOpenSource: false, }, grok4: { @@ -1571,7 +1877,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 256_000, }, icon: "xAI.png", - providerOptions: ["xAI", "askSage"], + providerOptions: ["xAI"], isOpenSource: false, }, grok3: { @@ -1585,7 +1891,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 131_072, }, icon: "xAI.png", - providerOptions: ["xAI", "askSage"], + providerOptions: ["xAI"], isOpenSource: false, }, grok3Mini: { @@ -1599,7 +1905,7 @@ export const models: { [key: string]: ModelPackage } = { contextLength: 131_072, }, icon: "xAI.png", - providerOptions: ["xAI", "askSage"], + providerOptions: ["xAI"], isOpenSource: false, }, gemma2_2b: { diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 280eb0ae9..88e091ce7 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -942,7 +942,6 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo ...completionParamsInputsConfigs, ], }, - askSage: { title: "Ask Sage", provider: "askSage", @@ -953,7 +952,7 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo tags: [ModelProviderTags.RequiresApiKey], params: { apiKey: "", - apiBase: "https://api.asksage.ai/server/", // Default base URL + apiBase: "https://api.asksage.ai/server/", }, collectInputFor: [ { @@ -967,32 +966,46 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo inputType: "text", key: "apiBase", label: "API Base URL", - placeholder: "Enter the API Base URL", + placeholder: "Enter your Ask Sage API base URL", required: true, + defaultValue: "https://api.asksage.ai/server/", }, ...completionParamsInputsConfigs, ], packages: [ - models.asksagegpt4ogov, - models.asksagegpt4ominigov, - models.asksagegpt4gov, - models.asksagegpt35gov, - models.gpt4o, - models.gpt4omini, - models.asksagegpt4, - models.asksagegpt432, - models.asksagegpto1, - models.asksagegpto1mini, - models.gpt35turbo, + models.asksageclaude45sonnet, + models.asksageclaude4sonnet, + models.asksageclaude41opus, + models.asksagegpt5, + models.asksagegpt5nano, + models.asksagegpt5mini, + models.asksagegemini20Flash, + models.asksagegemini25Pro, + models.asksagegemini25flash, models.asksageclaude35gov, - models.claude35Sonnet, - models.claude3Opus, - models.claude3Sonnet, - models.grokBeta, - models.asksagegroqllama33, + models.asksageclaude37sonnetgov, + models.asksagegpt4o, + models.asksagegpt4omini, + models.asksagegpt4gov, + models.asksagegpt4ogov, + models.asksagegpt35, + models.asksagegpt35gov, + models.asksagegpt4ominigov, + models.asksagegpt4, + models.asksagegpto1, + models.asksagegpt41, + models.asksagegpt41mini, + models.asksagegpt41nano, + models.asksagegpto3, + models.asksagegpt04mini, + models.asksagenovalite, models.asksagegroq70b, - models.mistralLarge, - models.llama370bChat, + models.asksagegroqllama33, + models.asksagegrok4, + models.asksageclaude35Sonnet, + models.asksageclaude37sonnet, + models.asksageclaude4s, + models.asksageclaude4o, ], apiKeyUrl: "https://chat.asksage.ai/", }, From 6748434c9cf5c9e4bdf44af225dc789a10652230 Mon Sep 17 00:00:00 2001 From: Ting-Wai <40179554+tingwai@users.noreply.github.com> Date: Wed, 8 Oct 2025 07:25:31 -0700 Subject: [PATCH 31/42] fix: flakey CLI tests (#8124) fix: flakey test with waitForNextRender --- .../ui/__tests__/TUIChat.fileSearch.test.tsx | 4 +-- .../src/ui/__tests__/TUIChat.input.test.tsx | 17 +++++++---- .../__tests__/TUIChat.slashCommands.test.tsx | 30 +++++++------------ .../src/ui/__tests__/TUIChat.testHelper.ts | 14 +++++++++ 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx b/extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx index f8d56a5f0..b38a90cb6 100644 --- a/extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx +++ b/extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx @@ -1,4 +1,5 @@ import { renderInMode, testSingleMode } from "./TUIChat.dualModeHelper.js"; +import { waitForNextRender } from "./TUIChat.testHelper.js"; describe("TUIChat - @ File Search Tests", () => { testSingleMode("shows @ character when user types @", "local", async () => { @@ -56,9 +57,8 @@ describe("TUIChat - @ File Search Tests", () => { // Type multiple @ characters stdin.write("@@test"); - // Wait for UI update - await new Promise((resolve) => setTimeout(resolve, 500)); + await waitForNextRender(); const frame = lastFrame(); diff --git a/extensions/cli/src/ui/__tests__/TUIChat.input.test.tsx b/extensions/cli/src/ui/__tests__/TUIChat.input.test.tsx index 35aa50a16..e76c00806 100644 --- a/extensions/cli/src/ui/__tests__/TUIChat.input.test.tsx +++ b/extensions/cli/src/ui/__tests__/TUIChat.input.test.tsx @@ -1,10 +1,12 @@ -import { testBothModes, renderInMode } from "./TUIChat.dualModeHelper.js"; +import { renderInMode, testBothModes } from "./TUIChat.dualModeHelper.js"; +import { waitForNextRender } from "./TUIChat.testHelper.js"; describe("TUIChat - User Input Tests", () => { - testBothModes("shows typed text in input field", (mode) => { + testBothModes("shows typed text in input field", async (mode) => { const { lastFrame, stdin } = renderInMode(mode); stdin.write("Testing 123"); + await waitForNextRender(); const frame = lastFrame(); // The input might be in a different format, let's be more flexible @@ -23,13 +25,14 @@ describe("TUIChat - User Input Tests", () => { testBothModes("handles Enter key to submit", async (mode) => { const { lastFrame, stdin } = renderInMode(mode); + await waitForNextRender(); const beforeEnter = lastFrame(); expect(beforeEnter).toContain("Ask anything"); stdin.write("\r"); // Wait for the UI to update after pressing enter - await new Promise((resolve) => setTimeout(resolve, 50)); + await new Promise((resolve) => setTimeout(resolve, 500)); const afterEnter = lastFrame(); @@ -46,11 +49,12 @@ describe("TUIChat - User Input Tests", () => { testBothModes( "handles special characters in input without crashing", - (mode) => { + async (mode) => { const { lastFrame, stdin } = renderInMode(mode); // Try typing various special characters stdin.write("!@#$%^&*()"); + await waitForNextRender(); const frame = lastFrame(); @@ -58,8 +62,9 @@ describe("TUIChat - User Input Tests", () => { expect(frame).toBeDefined(); expect(frame).not.toBe(""); - // UI should still be functional - expect(frame).toContain("Ask anything"); + // UI should still be functional and show the typed special characters + // Note: "Ask anything" placeholder is replaced when text is typed + expect(frame).toContain("!@#$%^&*()"); // Mode-specific UI elements if (mode === "remote") { diff --git a/extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx b/extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx index 9e67826c5..1f63f3814 100644 --- a/extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx +++ b/extensions/cli/src/ui/__tests__/TUIChat.slashCommands.test.tsx @@ -1,4 +1,5 @@ import { renderInMode, testBothModes } from "./TUIChat.dualModeHelper.js"; +import { waitForNextRender } from "./TUIChat.testHelper.js"; describe("TUIChat - Slash Commands Tests", () => { testBothModes("shows slash when user types /", async (mode) => { @@ -6,9 +7,7 @@ describe("TUIChat - Slash Commands Tests", () => { // Type / to trigger slash command stdin.write("/"); - - // Wait a bit for the UI to update - await new Promise((resolve) => setTimeout(resolve, 200)); + await waitForNextRender(); const frame = lastFrame(); @@ -29,9 +28,7 @@ describe("TUIChat - Slash Commands Tests", () => { // Type /exi to trigger slash command filtering stdin.write("/exi"); - - // Wait a bit for the UI to update (allow extra time in both modes) - await new Promise((resolve) => setTimeout(resolve, 600)); + await waitForNextRender(); const frame = lastFrame(); @@ -52,12 +49,10 @@ describe("TUIChat - Slash Commands Tests", () => { // Type /exi and then tab stdin.write("/exi"); - - await new Promise((resolve) => setTimeout(resolve, 200)); + await waitForNextRender(); stdin.write("\t"); - - await new Promise((resolve) => setTimeout(resolve, 200)); + await waitForNextRender(); const frameAfterTab = lastFrame(); @@ -80,8 +75,7 @@ describe("TUIChat - Slash Commands Tests", () => { // Type just / stdin.write("/"); - - await new Promise((resolve) => setTimeout(resolve, 600)); + await waitForNextRender(); const frame = lastFrame(); @@ -113,8 +107,7 @@ describe("TUIChat - Slash Commands Tests", () => { // Type a complete command name first stdin.write("/title"); - - await new Promise((resolve) => setTimeout(resolve, 200)); + await waitForNextRender(); const frameAfterCommand = lastFrame(); if (mode === "remote") { @@ -127,8 +120,7 @@ describe("TUIChat - Slash Commands Tests", () => { // Now add a space and arguments stdin.write(" My Session Title"); - - await new Promise((resolve) => setTimeout(resolve, 200)); + await waitForNextRender(); const frameAfterArgs = lastFrame(); @@ -151,8 +143,7 @@ describe("TUIChat - Slash Commands Tests", () => { // Type a complete command with arguments stdin.write("/title Test Session"); - - await new Promise((resolve) => setTimeout(resolve, 200)); + await waitForNextRender(); const frameBeforeEnter = lastFrame(); expect(frameBeforeEnter).toContain("/title"); @@ -160,8 +151,7 @@ describe("TUIChat - Slash Commands Tests", () => { // Press Enter - this should execute the command, not try to autocomplete stdin.write("\r"); - - await new Promise((resolve) => setTimeout(resolve, 300)); + await waitForNextRender(); const frameAfterEnter = lastFrame(); diff --git a/extensions/cli/src/ui/__tests__/TUIChat.testHelper.ts b/extensions/cli/src/ui/__tests__/TUIChat.testHelper.ts index e450b809a..37ebb5c3e 100644 --- a/extensions/cli/src/ui/__tests__/TUIChat.testHelper.ts +++ b/extensions/cli/src/ui/__tests__/TUIChat.testHelper.ts @@ -422,6 +422,20 @@ export async function sendMessage( await new Promise((resolve) => setTimeout(resolve, waitTime)); } +/** + * Helper to wait for next render cycle to complete + * Use this after stdin.write() to ensure at least one render has occurred + * This prevents flaky tests caused by calling lastFrame() before React renders + */ +export async function waitForNextRender(): Promise { + // Wait for multiple ticks to ensure render completes + await new Promise((resolve) => setImmediate(resolve)); + await new Promise((resolve) => setImmediate(resolve)); + // Add a delay to allow Ink terminal UI to render + // CI environments are slower, so we need a longer delay + await new Promise((resolve) => setTimeout(resolve, 500)); +} + /** * Helper to check if UI shows remote mode indicators */ From b62564cce47386365530782a3ac45a85f08ca347 Mon Sep 17 00:00:00 2001 From: "continue[bot]" <230936708+continue[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 07:27:19 -0700 Subject: [PATCH 32/42] Add 'Explore MCP Servers' option to /mcp slash command (#8123) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added '🔍 Explore MCP Servers' option at the bottom of the MCP selector menu - Opens https://hub.continue.dev/?type=mcpServers in default browser - Uses existing 'open' package dependency Generated with [Continue](https://continue.dev) Co-authored-by: Continue Agent Co-authored-by: Continue Co-authored-by: Username --- extensions/cli/src/ui/MCPSelector.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/extensions/cli/src/ui/MCPSelector.tsx b/extensions/cli/src/ui/MCPSelector.tsx index 99523c63c..e974c6f8c 100644 --- a/extensions/cli/src/ui/MCPSelector.tsx +++ b/extensions/cli/src/ui/MCPSelector.tsx @@ -117,6 +117,13 @@ export const MCPSelector: React.FC = ({ onCancel }) => { { label: "⏹️ Stop all servers", value: "stop-all" }, ); } + + // Add "Explore MCP Servers" option at the bottom + options.push({ + label: "🔍 Explore MCP Servers", + value: "explore-mcp-servers", + }); + return options; }; @@ -280,6 +287,12 @@ export const MCPSelector: React.FC = ({ onCancel }) => { await mcpService.shutdownConnections(); setMessage("All servers stopped"); break; + case "explore-mcp-servers": + // Open the MCP servers hub in the default browser + const open = (await import("open")).default; + await open("https://hub.continue.dev/?type=mcpServers"); + setMessage("Opened MCP servers hub in browser"); + break; case "back": onCancel(); return; From ad8a597445f86eb8c5e3ce2ff37b9b6dc9709334 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Wed, 8 Oct 2025 07:27:45 -0700 Subject: [PATCH 33/42] Revise build steps in BUILD.md (#8130) Updated build steps to include building local packages before installation. --- extensions/cli/BUILD.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/cli/BUILD.md b/extensions/cli/BUILD.md index 553660f94..ae805a800 100644 --- a/extensions/cli/BUILD.md +++ b/extensions/cli/BUILD.md @@ -6,8 +6,9 @@ The Continue CLI uses esbuild to bundle the application along with local package ## Build Steps -1. **Install dependencies**: `npm install` -2. **Build**: `npm run build` +1. **Build packages**: `cd ../../ && node ./scripts/build-packages.js` +2. **Install dependencies**: `npm install` +3. **Build**: `npm run build` - This first builds the local packages - Then bundles everything with esbuild From 80e99a5593fa62228c93ab46001763d62d68c7c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=AA=20T=E1=BA=A5n=20L=E1=BB=99c?= <26348718+letanloc1998@users.noreply.github.com> Date: Wed, 8 Oct 2025 21:28:38 +0700 Subject: [PATCH 34/42] Fix wrong document about Force Legacy Completions Endpoint (#8133) --- docs/customize/model-providers/top-level/openai.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/customize/model-providers/top-level/openai.mdx b/docs/customize/model-providers/top-level/openai.mdx index 9537ac133..3249e27c9 100644 --- a/docs/customize/model-providers/top-level/openai.mdx +++ b/docs/customize/model-providers/top-level/openai.mdx @@ -90,7 +90,7 @@ If you are using an OpenAI API compatible providers, you can change the `apiBase ### How to Force Legacy Completions Endpoint Usage -To force usage of `chat/completions` instead of `completions` endpoint you can set: +To force usage of `completions` instead of `chat/completions` endpoint you can set: From eba67ef1fb8fd931230bee5deda95f1e5c00d9ab Mon Sep 17 00:00:00 2001 From: "continue[bot]" <230936708+continue[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 08:17:47 -0700 Subject: [PATCH 35/42] Add organization name display to CLI intro screen (#8041) - Add organizationName prop to IntroMessage component - Display 'Org: [ORG_NAME]' above 'Agent: [AGENT_NAME]' - Fetch organization name from auth service in TUIChat - Add useOrganizationName hook to resolve org ID to name - Pass organizationName through StaticChatContent - Update tests to verify org display behavior Generated with [Continue](https://continue.dev) Co-authored-by: Continue Agent Co-authored-by: Continue Co-authored-by: Nate --- extensions/cli/src/ui/IntroMessage.test.tsx | 15 +++++++ extensions/cli/src/ui/IntroMessage.tsx | 9 ++++ extensions/cli/src/ui/TUIChat.tsx | 43 +++++++++++++++++++ .../src/ui/components/StaticChatContent.tsx | 4 ++ 4 files changed, 71 insertions(+) diff --git a/extensions/cli/src/ui/IntroMessage.test.tsx b/extensions/cli/src/ui/IntroMessage.test.tsx index a21d6f79c..6f024b96e 100644 --- a/extensions/cli/src/ui/IntroMessage.test.tsx +++ b/extensions/cli/src/ui/IntroMessage.test.tsx @@ -81,4 +81,19 @@ describe("IntroMessage", () => { expect(lastFrame()).toContain("Model:"); expect(lastFrame()).toContain("Loading..."); }); + + it("renders organization name when provided", () => { + const { lastFrame } = render( + , + ); + + expect(lastFrame()).toContain("Org:"); + expect(lastFrame()).toContain("Test Organization"); + }); + + it("does not render organization section when not provided", () => { + const { lastFrame } = render(); + + expect(lastFrame()).not.toContain("Org:"); + }); }); diff --git a/extensions/cli/src/ui/IntroMessage.tsx b/extensions/cli/src/ui/IntroMessage.tsx index e26448479..139db3e8b 100644 --- a/extensions/cli/src/ui/IntroMessage.tsx +++ b/extensions/cli/src/ui/IntroMessage.tsx @@ -13,6 +13,7 @@ interface IntroMessageProps { config?: AssistantUnrolled; model?: ModelConfig; mcpService?: MCPService; + organizationName?: string; } // Helper function to extract rule names @@ -26,6 +27,7 @@ const IntroMessage: React.FC = ({ config, model, mcpService, + organizationName, }) => { // Get MCP prompts directly (not memoized since they can change after first render) const mcpPrompts = mcpService?.getState().prompts ?? []; @@ -98,6 +100,13 @@ const IntroMessage: React.FC = ({ {/* Tips Display - shown randomly 1 in 5 times */} {showTip && } + {/* Organization name */} + {organizationName && ( + + Org: {organizationName} + + )} + {/* Agent name */} {config && ( diff --git a/extensions/cli/src/ui/TUIChat.tsx b/extensions/cli/src/ui/TUIChat.tsx index 555c32829..aea25bc19 100644 --- a/extensions/cli/src/ui/TUIChat.tsx +++ b/extensions/cli/src/ui/TUIChat.tsx @@ -9,6 +9,7 @@ import React, { import { ToolPermissionServiceState } from "src/services/ToolPermissionService.js"; +import { listUserOrganizations } from "../auth/workos.js"; import { useServices } from "../hooks/useService.js"; import { ApiClientServiceState, @@ -110,6 +111,44 @@ function useTUIChatServices(remoteUrl?: string) { return { services, allServicesReady, isRemoteMode }; } +// Custom hook to fetch organization name +function useOrganizationName(organizationId?: string): string | undefined { + const [organizationName, setOrganizationName] = useState( + undefined, + ); + + useEffect(() => { + if (!organizationId) { + setOrganizationName(undefined); + return; + } + + let isMounted = true; + + async function fetchOrgName() { + try { + const orgs = await listUserOrganizations(); + if (!isMounted) return; + + const org = orgs?.find((o) => o.id === organizationId); + if (org) { + setOrganizationName(org.name); + } + } catch (error) { + logger.debug("Failed to fetch organization name", { error }); + } + } + + fetchOrgName(); + + return () => { + isMounted = false; + }; + }, [organizationId]); + + return organizationName; +} + // Custom hook for chat handlers function useChatHandlers( setShowIntroMessage: (show: boolean) => void, @@ -298,6 +337,9 @@ const TUIChat: React.FC = ({ // State for image in clipboard status const [hasImageInClipboard, setHasImageInClipboard] = useState(false); + // Fetch organization name based on auth state + const organizationName = useOrganizationName(services.auth?.organizationId); + return ( {/* Chat history - takes up all available space above input */} @@ -320,6 +362,7 @@ const TUIChat: React.FC = ({ config={services.config?.config || undefined} model={services.model?.model || undefined} mcpService={services.mcp?.mcpService || undefined} + organizationName={organizationName} chatHistory={chatHistory} queuedMessages={queuedMessages} renderMessage={renderMessage} diff --git a/extensions/cli/src/ui/components/StaticChatContent.tsx b/extensions/cli/src/ui/components/StaticChatContent.tsx index 5cb553762..09f9d8bf5 100644 --- a/extensions/cli/src/ui/components/StaticChatContent.tsx +++ b/extensions/cli/src/ui/components/StaticChatContent.tsx @@ -14,6 +14,7 @@ interface StaticChatContentProps { config?: AssistantUnrolled; model?: ModelConfig; mcpService?: MCPService; + organizationName?: string; chatHistory: ChatHistoryItem[]; queuedMessages?: QueuedMessage[]; renderMessage: ( @@ -29,6 +30,7 @@ export const StaticChatContent: React.FC = ({ config, model, mcpService, + organizationName, chatHistory, queuedMessages = [], renderMessage, @@ -96,6 +98,7 @@ export const StaticChatContent: React.FC = ({ config={config} model={model} mcpService={mcpService} + organizationName={organizationName} />, ); } @@ -129,6 +132,7 @@ export const StaticChatContent: React.FC = ({ config, model, mcpService, + organizationName, processedChatHistory, renderMessage, ]); From c7b8e0f29e7adfb7726a17cc06c2e0e0927f417f Mon Sep 17 00:00:00 2001 From: Aditya Mitra <61635505+uinstinct@users.noreply.github.com> Date: Wed, 8 Oct 2025 20:53:21 +0530 Subject: [PATCH 36/42] feat(cli): mcp oauth using mcp-remote (#8143) * feat(cli): mcp oauth using mcp-remote * Update MCPService.ts --------- Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com> --- extensions/cli/src/services/MCPService.ts | 49 ++++++++++++++++++----- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/extensions/cli/src/services/MCPService.ts b/extensions/cli/src/services/MCPService.ts index 069171fef..c4885f120 100644 --- a/extensions/cli/src/services/MCPService.ts +++ b/extensions/cli/src/services/MCPService.ts @@ -1,6 +1,9 @@ import { type AssistantConfig } from "@continuedev/sdk"; import { Client } from "@modelcontextprotocol/sdk/client/index.js"; -import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; +import { + SSEClientTransport, + SseError, +} from "@modelcontextprotocol/sdk/client/sse.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; import { @@ -21,6 +24,14 @@ import { SERVICE_NAMES, } from "./types.js"; +function is401Error(error: unknown) { + return ( + (error instanceof SseError && error.code === 401) || + (error instanceof Error && error.message.includes("401")) || + (error instanceof Error && error.message.includes("Unauthorized")) + ); +} + interface ServerConnection extends MCPConnectionInfo { client: Client | null; } @@ -366,15 +377,29 @@ export class MCPService url: serverConfig.url, }); - if (serverConfig.type === "sse") { - const transport = this.constructSseTransport(serverConfig); - await client.connect(transport, {}); - } else if (serverConfig.type === "streamable-http") { - const transport = this.constructHttpTransport(serverConfig); - await client.connect(transport, {}); - } else if (serverConfig.type) { - throw new Error(`Unsupported transport type: ${serverConfig.type}`); - } else { + try { + if (serverConfig.type === "sse") { + const transport = this.constructSseTransport(serverConfig); + await client.connect(transport, {}); + } else if (serverConfig.type === "streamable-http") { + const transport = this.constructHttpTransport(serverConfig); + await client.connect(transport, {}); + } + } catch (error: unknown) { + // on authorization error, use "mcp-remote" with stdio transport to connect + if (is401Error(error)) { + const transport = this.constructStdioTransport({ + name: serverConfig.name, + command: "npx", + args: ["-y", "mcp-remote", serverConfig.url], + }); + await client.connect(transport, {}); + } else { + throw error; + } + } + + if (typeof serverConfig.type === "undefined") { try { const transport = this.constructHttpTransport(serverConfig); await client.connect(transport, {}); @@ -394,6 +419,10 @@ export class MCPService ); } } + } else if ( + !["streamable-http", "sse", "stdio"].includes(serverConfig.type) + ) { + throw new Error(`Unsupported transport type: ${serverConfig.type}`); } } From 9164448c73cf746031203d75a27b5db0ab2bc42c Mon Sep 17 00:00:00 2001 From: "continue[bot]" <230936708+continue[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 08:33:30 -0700 Subject: [PATCH 37/42] Add apiKey field to mcpServers block schema for Bearer token auth (#8120) Add apiKey field to mcpServers schema and implement Bearer token auth - Add apiKey field to sseOrHttpMcpServerSchema in packages/config-yaml - Update MCPConnection.ts to merge apiKey as Bearer token in Authorization header - Update CLI MCPService to merge apiKey as Bearer token in Authorization header - Add apiKey to InternalSseMcpOptions and InternalStreamableHttpMcpOptions types - Update yamlToContinueConfig converter to pass through apiKey field Fixes CON-4281 Generated with [Continue](https://continue.dev) Co-authored-by: Continue Agent Co-authored-by: Continue Co-authored-by: nate --- core/config/yaml/yamlToContinueConfig.ts | 3 ++- core/context/mcp/MCPConnection.ts | 18 ++++++++++++--- core/index.d.ts | 2 ++ extensions/cli/src/services/MCPService.ts | 22 ++++++++++++++++--- packages/config-yaml/src/schemas/mcp/index.ts | 1 + 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/core/config/yaml/yamlToContinueConfig.ts b/core/config/yaml/yamlToContinueConfig.ts index 7d6bd810e..d639e4515 100644 --- a/core/config/yaml/yamlToContinueConfig.ts +++ b/core/config/yaml/yamlToContinueConfig.ts @@ -58,13 +58,14 @@ export function convertYamlMcpConfigToInternalMcpOptions( return stdioOptions; } // HTTP/SSE - const { type, url, requestOptions } = config; + const { type, url, apiKey, requestOptions } = config; const httpSseConfig: | InternalStreamableHttpMcpOptions | InternalSseMcpOptions = { ...shared, type, url, + apiKey, requestOptions: mergeConfigYamlRequestOptions( requestOptions, globalRequestOptions, diff --git a/core/context/mcp/MCPConnection.ts b/core/context/mcp/MCPConnection.ts index 9214375c8..4090e92c5 100644 --- a/core/context/mcp/MCPConnection.ts +++ b/core/context/mcp/MCPConnection.ts @@ -468,6 +468,12 @@ class MCPConnection { ? new HttpsAgent({ rejectUnauthorized: false }) : undefined; + // Merge apiKey into headers if provided + const headers = { + ...options.requestOptions?.headers, + ...(options.apiKey && { Authorization: `Bearer ${options.apiKey}` }), + }; + return new SSEClientTransport(new URL(options.url), { eventSourceInit: { fetch: (input, init) => @@ -475,13 +481,13 @@ class MCPConnection { ...init, headers: { ...init?.headers, - ...options.requestOptions?.headers, + ...headers, }, ...(sseAgent && { agent: sseAgent }), }), }, requestInit: { - headers: options.requestOptions?.headers, + headers, ...(sseAgent && { agent: sseAgent }), }, }); @@ -496,9 +502,15 @@ class MCPConnection { ? new HttpsAgent({ rejectUnauthorized: false }) : undefined; + // Merge apiKey into headers if provided + const headers = { + ...requestOptions?.headers, + ...(options.apiKey && { Authorization: `Bearer ${options.apiKey}` }), + }; + return new StreamableHTTPClientTransport(new URL(url), { requestInit: { - headers: requestOptions?.headers, + headers, ...(streamableAgent && { agent: streamableAgent }), }, }); diff --git a/core/index.d.ts b/core/index.d.ts index bd21d4fe8..fb59d97bd 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1350,11 +1350,13 @@ export type InternalStdioMcpOptions = BaseInternalMCPOptions & { export type InternalStreamableHttpMcpOptions = BaseInternalMCPOptions & { type?: "streamable-http"; url: string; + apiKey?: string; }; export type InternalSseMcpOptions = BaseInternalMCPOptions & { type?: "sse"; url: string; + apiKey?: string; }; export type InternalWebsocketMcpOptions = BaseInternalMCPOptions & { diff --git a/extensions/cli/src/services/MCPService.ts b/extensions/cli/src/services/MCPService.ts index c4885f120..08190e267 100644 --- a/extensions/cli/src/services/MCPService.ts +++ b/extensions/cli/src/services/MCPService.ts @@ -432,6 +432,14 @@ export class MCPService private constructSseTransport( serverConfig: SseMcpServer, ): SSEClientTransport { + // Merge apiKey into headers if provided + const headers = { + ...serverConfig.requestOptions?.headers, + ...(serverConfig.apiKey && { + Authorization: `Bearer ${serverConfig.apiKey}`, + }), + }; + return new SSEClientTransport(new URL(serverConfig.url), { eventSourceInit: { fetch: (input, init) => @@ -439,18 +447,26 @@ export class MCPService ...init, headers: { ...init?.headers, - ...serverConfig.requestOptions?.headers, + ...headers, }, }), }, - requestInit: { headers: serverConfig.requestOptions?.headers }, + requestInit: { headers }, }); } private constructHttpTransport( serverConfig: HttpMcpServer, ): StreamableHTTPClientTransport { + // Merge apiKey into headers if provided + const headers = { + ...serverConfig.requestOptions?.headers, + ...(serverConfig.apiKey && { + Authorization: `Bearer ${serverConfig.apiKey}`, + }), + }; + return new StreamableHTTPClientTransport(new URL(serverConfig.url), { - requestInit: { headers: serverConfig.requestOptions?.headers }, + requestInit: { headers }, }); } private constructStdioTransport( diff --git a/packages/config-yaml/src/schemas/mcp/index.ts b/packages/config-yaml/src/schemas/mcp/index.ts index 0f1778882..b0ede8778 100644 --- a/packages/config-yaml/src/schemas/mcp/index.ts +++ b/packages/config-yaml/src/schemas/mcp/index.ts @@ -21,6 +21,7 @@ export type StdioMcpServer = z.infer; const sseOrHttpMcpServerSchema = baseMcpServerSchema.extend({ url: z.string(), // .url() fails with e.g. IP addresses type: z.union([z.literal("sse"), z.literal("streamable-http")]).optional(), + apiKey: z.string().optional(), requestOptions: requestOptionsSchema.optional(), }); export type SseMcpServer = z.infer; From 7b17637763530100923298d4e12907385ccf300e Mon Sep 17 00:00:00 2001 From: "continue[bot]" <230936708+continue[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 09:49:36 -0700 Subject: [PATCH 38/42] Allow --mcp flag to accept URLs for streamable-http servers (#8119) * Allow --mcp flag to accept URLs for streamable-http servers When a URL starting with http:// or https:// is passed to the --mcp flag, it will now automatically be configured as a streamable-http MCP server connection instead of trying to load it from the hub. This allows users to run: cn --mcp https://docs.continue.dev/mcp The URL will be parsed and configured with: - type: streamable-http - url: the provided URL - name: hostname from the URL Fixes CON-4285 Generated with [Continue](https://continue.dev) Co-authored-by: Username * fix: tests --------- Co-authored-by: Continue Agent Co-authored-by: Username Co-authored-by: Nate --- extensions/cli/src/configEnhancer.test.ts | 75 +++++++++++++++++-- extensions/cli/src/configEnhancer.ts | 23 +++++- .../src/services/workflow-integration.test.ts | 41 +++++++--- 3 files changed, 122 insertions(+), 17 deletions(-) diff --git a/extensions/cli/src/configEnhancer.test.ts b/extensions/cli/src/configEnhancer.test.ts index 3aaea15b4..4b37951d5 100644 --- a/extensions/cli/src/configEnhancer.test.ts +++ b/extensions/cli/src/configEnhancer.test.ts @@ -196,11 +196,12 @@ describe("ConfigEnhancer", () => { }); it("should prepend MCPs from --mcp flag", async () => { - // Mock loadPackagesFromHub to return test MCPs - const { loadPackagesFromHub } = await import("./hubLoader.js"); - (loadPackagesFromHub as any).mockResolvedValueOnce([ - { name: "New-MCP", command: "new-mcp" }, - ]); + // Mock loadPackageFromHub to return test MCP (singular call for each MCP) + const { loadPackageFromHub } = await import("./hubLoader.js"); + (loadPackageFromHub as any).mockResolvedValueOnce({ + name: "New-MCP", + command: "new-mcp", + }); // Set up existing MCPs in config mockConfig.mcpServers = [{ name: "Existing-MCP", command: "existing-mcp" }]; @@ -223,6 +224,70 @@ describe("ConfigEnhancer", () => { }); }); + it("should handle URLs in --mcp flag as streamable-http servers", async () => { + // Set up existing MCPs in config + mockConfig.mcpServers = [{ name: "Existing-MCP", command: "existing-mcp" }]; + + const options: BaseCommandOptions = { + mcp: ["https://docs.continue.dev/mcp"], + }; + + const config = await enhancer.enhanceConfig(mockConfig, options); + + // URL should be converted to streamable-http MCP configuration + expect(config.mcpServers).toHaveLength(2); + expect(config.mcpServers?.[0]).toEqual({ + name: "docs.continue.dev", + type: "streamable-http", + url: "https://docs.continue.dev/mcp", + }); + expect(config.mcpServers?.[1]).toEqual({ + name: "Existing-MCP", + command: "existing-mcp", + }); + }); + + it("should handle mix of URLs and hub slugs in --mcp flag", async () => { + // Mock loadPackageFromHub to return test MCP for hub slug + const { loadPackageFromHub } = await import("./hubLoader.js"); + (loadPackageFromHub as any).mockResolvedValueOnce({ + name: "Hub-MCP", + command: "hub-mcp", + }); + + const options: BaseCommandOptions = { + mcp: ["https://example.com/mcp", "test/hub-mcp"], + }; + + const config = await enhancer.enhanceConfig(mockConfig, options); + + expect(config.mcpServers).toHaveLength(2); + expect(config.mcpServers?.[0]).toEqual({ + name: "example.com", + type: "streamable-http", + url: "https://example.com/mcp", + }); + expect(config.mcpServers?.[1]).toEqual({ + name: "Hub-MCP", + command: "hub-mcp", + }); + }); + + it("should handle http:// URLs in --mcp flag", async () => { + const options: BaseCommandOptions = { + mcp: ["http://localhost:8080/mcp"], + }; + + const config = await enhancer.enhanceConfig(mockConfig, options); + + expect(config.mcpServers).toHaveLength(1); + expect(config.mcpServers?.[0]).toEqual({ + name: "localhost", + type: "streamable-http", + url: "http://localhost:8080/mcp", + }); + }); + it("should handle workflow integration gracefully when no workflow", async () => { // The mocked service container returns null workflow state const options: BaseCommandOptions = { diff --git a/extensions/cli/src/configEnhancer.ts b/extensions/cli/src/configEnhancer.ts index 49e464f2f..b299e871b 100644 --- a/extensions/cli/src/configEnhancer.ts +++ b/extensions/cli/src/configEnhancer.ts @@ -171,7 +171,28 @@ export class ConfigEnhancer { config: AssistantUnrolled, mcps: string[], ): Promise { - const processedMcps = await loadPackagesFromHub(mcps, mcpProcessor); + const processedMcps: any[] = []; + + // Process each MCP spec - check if it's a URL or hub slug + for (const mcpSpec of mcps) { + try { + // Check if it's a URL (starts with http:// or https://) + if (mcpSpec.startsWith("http://") || mcpSpec.startsWith("https://")) { + // Create a streamable-http MCP configuration + processedMcps.push({ + name: new URL(mcpSpec).hostname, + type: "streamable-http", + url: mcpSpec, + }); + } else { + // Otherwise, treat it as a hub slug + const hubMcp = await loadPackageFromHub(mcpSpec, mcpProcessor); + processedMcps.push(hubMcp); + } + } catch (error: any) { + logger.warn(`Failed to load MCP "${mcpSpec}": ${error.message}`); + } + } // Clone the config to avoid mutating the original const modifiedConfig = { ...config }; diff --git a/extensions/cli/src/services/workflow-integration.test.ts b/extensions/cli/src/services/workflow-integration.test.ts index 7c688d89c..6d68563af 100644 --- a/extensions/cli/src/services/workflow-integration.test.ts +++ b/extensions/cli/src/services/workflow-integration.test.ts @@ -554,11 +554,19 @@ describe("Workflow Integration Tests", () => { tools: "owner/mcp1, another/mcp2:specific_tool", }; - mockLoadPackageFromHub.mockResolvedValue(workflowWithTools); - mockLoadPackagesFromHub.mockResolvedValue([ - { name: "mcp1" }, - { name: "mcp2" }, - ]); + // Clear the default mock and setup specific mocks + mockLoadPackageFromHub.mockReset(); + // First call loads the workflow file + mockLoadPackageFromHub.mockResolvedValueOnce(workflowWithTools); + // Second call loads the workflow model + mockLoadPackageFromHub.mockResolvedValueOnce({ + name: "gpt-4-workflow", + provider: "openai", + }); + // Third call loads mcp1 + mockLoadPackageFromHub.mockResolvedValueOnce({ name: "mcp1" }); + // Fourth call loads mcp2 + mockLoadPackageFromHub.mockResolvedValueOnce({ name: "mcp2" }); await workflowService.initialize("owner/workflow"); @@ -573,6 +581,7 @@ describe("Workflow Integration Tests", () => { ); expect(enhancedConfig.mcpServers).toHaveLength(3); + // MCPs are prepended in the order they are loaded expect(enhancedConfig.mcpServers?.[0]).toEqual({ name: "mcp1" }); expect(enhancedConfig.mcpServers?.[1]).toEqual({ name: "mcp2" }); expect(enhancedConfig.mcpServers?.[2]).toEqual({ name: "existing-mcp" }); @@ -584,7 +593,8 @@ describe("Workflow Integration Tests", () => { tools: undefined, }; - mockLoadPackageFromHub.mockResolvedValue(workflowWithoutTools); + mockLoadPackageFromHub.mockReset(); + mockLoadPackageFromHub.mockResolvedValueOnce(workflowWithoutTools); await workflowService.initialize("owner/workflow"); const baseConfig = { @@ -607,13 +617,22 @@ describe("Workflow Integration Tests", () => { tools: "owner/mcp1, owner/mcp1:tool1, owner/mcp1:tool2", }; - mockLoadPackageFromHub.mockResolvedValue(workflowWithDuplicateTools); - mockLoadPackagesFromHub.mockResolvedValue([{ name: "mcp1" }]); + // Clear the default mock and setup specific mocks + mockLoadPackageFromHub.mockReset(); + // First call loads the workflow file + mockLoadPackageFromHub.mockResolvedValueOnce(workflowWithDuplicateTools); + // Second call loads the workflow model + mockLoadPackageFromHub.mockResolvedValueOnce({ + name: "gpt-4-workflow", + provider: "openai", + }); + // Third call: The parseWorkflowTools will extract only unique MCP servers, so only one loadPackageFromHub call + mockLoadPackageFromHub.mockResolvedValueOnce({ name: "mcp1" }); await workflowService.initialize("owner/workflow"); const baseConfig = { - mcpServers: [{ name: "mcp1" }], // Already exists + mcpServers: [{ name: "existing-mcp" }], // Changed to avoid confusion }; const enhancedConfig = await configEnhancer.enhanceConfig( @@ -622,10 +641,10 @@ describe("Workflow Integration Tests", () => { workflowService.getState(), ); - // Should not deduplicate since we simplified the logic + // parseWorkflowTools deduplicates, so we only get mcp1 once expect(enhancedConfig.mcpServers).toHaveLength(2); expect(enhancedConfig.mcpServers?.[0]).toEqual({ name: "mcp1" }); - expect(enhancedConfig.mcpServers?.[1]).toEqual({ name: "mcp1" }); + expect(enhancedConfig.mcpServers?.[1]).toEqual({ name: "existing-mcp" }); }); }); }); From f56d2b0a7bdf472e5c42c168a85bc05ecb47bd08 Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Wed, 8 Oct 2025 13:09:50 -0700 Subject: [PATCH 39/42] fix: improvements to next edit (#8129) * refactor: autocomplete feedback * fix: don't hardcode outcome to false on aborted completion * fix: correctly parse out backticks * fix: correctly parse out backticks * fix: next edit diff formatting * fix: reduce context lines * improv: track profile type for autocomplete * fix: lint err * fix: test --- core/autocomplete/CompletionProvider.ts | 2 + core/autocomplete/postprocessing/index.ts | 17 +- .../util/AutocompleteLoggingService.ts | 1 + core/autocomplete/util/types.ts | 1 + core/config/ConfigHandler.ts | 11 +- core/nextEdit/NextEditLoggingService.ts | 51 +---- core/nextEdit/NextEditPrefetchQueue.ts | 2 +- core/nextEdit/NextEditProvider.ts | 40 +++- core/nextEdit/context/diffFormatting.ts | 20 +- .../nextEdit/context/diffFormatting.vitest.ts | 66 +++++++ core/nextEdit/context/processNextEditData.ts | 1 + core/nextEdit/context/processSmallEdit.ts | 21 +- .../providers/BaseNextEditProvider.ts | 183 ++++++++++++------ core/nextEdit/types.ts | 1 + .../GhostTextAcceptanceTracker.ts | 2 +- .../vscode/src/util/editLoggingUtils.ts | 21 -- 16 files changed, 286 insertions(+), 154 deletions(-) diff --git a/core/autocomplete/CompletionProvider.ts b/core/autocomplete/CompletionProvider.ts index 6deb9d132..5001a6203 100644 --- a/core/autocomplete/CompletionProvider.ts +++ b/core/autocomplete/CompletionProvider.ts @@ -268,6 +268,8 @@ export class CompletionProvider { gitRepo: await this.ide.getRepoName(helper.filepath), uniqueId: await this.ide.getUniqueId(), timestamp: new Date().toISOString(), + profileType: + this.configHandler.currentProfile?.profileDescription.profileType, ...helper.options, }; diff --git a/core/autocomplete/postprocessing/index.ts b/core/autocomplete/postprocessing/index.ts index 35e507a7c..11cdf88d4 100644 --- a/core/autocomplete/postprocessing/index.ts +++ b/core/autocomplete/postprocessing/index.ts @@ -54,7 +54,8 @@ function isBlank(completion: string): boolean { /** * Removes markdown code block delimiters from completion. - * Removes the first line if it starts with "```" and the last line if it is exactly "```". + * Removes the first line if it starts with backticks (with optional language name). + * Removes the last line if it contains only backticks. */ function removeBackticks(completion: string): string { const lines = completion.split("\n"); @@ -66,14 +67,18 @@ function removeBackticks(completion: string): string { let startIdx = 0; let endIdx = lines.length; - // Remove first line if it starts with ``` - if (lines[0].trimStart().startsWith("```")) { + // Remove first line if it starts with backticks (``` or ```language) + const firstLineTrimmed = lines[0].trim(); + if (firstLineTrimmed.startsWith("```")) { startIdx = 1; } - // Remove last line if it is exactly ``` - if (lines.length > startIdx && lines[lines.length - 1].trim() === "```") { - endIdx = lines.length - 1; + // Remove last line if it contains only backticks (one or more) + if (lines.length > startIdx) { + const lastLineTrimmed = lines[lines.length - 1].trim(); + if (lastLineTrimmed.length > 0 && /^`+$/.test(lastLineTrimmed)) { + endIdx = lines.length - 1; + } } // If we removed lines, return the modified completion diff --git a/core/autocomplete/util/AutocompleteLoggingService.ts b/core/autocomplete/util/AutocompleteLoggingService.ts index 58b3d2d0d..b84aaf156 100644 --- a/core/autocomplete/util/AutocompleteLoggingService.ts +++ b/core/autocomplete/util/AutocompleteLoggingService.ts @@ -119,6 +119,7 @@ export class AutocompleteLoggingService { time: restOfOutcome.time, useRecentlyEdited: restOfOutcome.useRecentlyEdited, numLines: restOfOutcome.numLines, + profileType: restOfOutcome.profileType, }; outcome.enabledStaticContextualization diff --git a/core/autocomplete/util/types.ts b/core/autocomplete/util/types.ts index 4f669fc63..eb9a75fa1 100644 --- a/core/autocomplete/util/types.ts +++ b/core/autocomplete/util/types.ts @@ -43,4 +43,5 @@ export interface AutocompleteOutcome extends TabAutocompleteOptions { uniqueId: string; timestamp: string; enabledStaticContextualization?: boolean; + profileType?: "local" | "platform" | "control-plane"; } diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 4127f2097..6eaabea60 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -537,12 +537,19 @@ export class ConfigHandler { // Track config loading telemetry const endTime = performance.now(); const duration = endTime - startTime; - void Telemetry.capture("config_reload", { + + const profileDescription = this.currentProfile.profileDescription; + const telemetryData: Record = { duration, reason, totalConfigLoads: this.totalConfigReloads, configLoadInterrupted, - }); + profileType: profileDescription.profileType, + isPersonalOrg: this.currentOrg?.id === this.PERSONAL_ORG_DESC.id, + errorCount: errors.length, + }; + + void Telemetry.capture("config_reload", telemetryData); return { config, diff --git a/core/nextEdit/NextEditLoggingService.ts b/core/nextEdit/NextEditLoggingService.ts index 6d003e5d9..430cb576a 100644 --- a/core/nextEdit/NextEditLoggingService.ts +++ b/core/nextEdit/NextEditLoggingService.ts @@ -95,9 +95,6 @@ export class NextEditLoggingService { outcome.accepted = true; outcome.aborted = false; this.logNextEditOutcome(outcome); - if (outcome.requestId) { - void this.logAcceptReject(outcome.requestId, true); - } this._outcomes.delete(completionId); return outcome; } @@ -116,9 +113,6 @@ export class NextEditLoggingService { outcome.accepted = false; outcome.aborted = false; this.logNextEditOutcome(outcome); - if (outcome.requestId) { - void this.logAcceptReject(outcome.requestId, false); - } this._outcomes.delete(completionId); return outcome; } @@ -151,9 +145,6 @@ export class NextEditLoggingService { outcome.accepted = false; outcome.aborted = false; this.logNextEditOutcome(outcome); - if (outcome.requestId) { - void this.logAcceptReject(outcome.requestId, false); - } this._logRejectionTimeouts.delete(completionId); this._outcomes.delete(completionId); }, COUNT_COMPLETION_REJECTED_AFTER); @@ -197,44 +188,15 @@ export class NextEditLoggingService { this._logRejectionTimeouts.delete(completionId); } - // If we have the full outcome, log it as aborted. + // Only log if the completion was displayed to the user. + // This aligns with Autocomplete behavior and prevents logging + // of cancelled requests that never reached the user. if (this._outcomes.has(completionId)) { const outcome = this._outcomes.get(completionId)!; - outcome.accepted = false; + // outcome.accepted = false; outcome.aborted = true; this.logNextEditOutcome(outcome); this._outcomes.delete(completionId); - } else { - // Log minimal abort event for requests that never got displayed. - const pendingData = this._pendingCompletions.get(completionId); - - const minimalAbortOutcome: Partial = { - completionId, - accepted: false, - aborted: true, - timestamp: Date.now(), - uniqueId: completionId, - elapsed: pendingData ? Date.now() - pendingData.startTime : 0, - modelName: pendingData?.modelName || "unknown", - modelProvider: pendingData?.modelProvider || "unknown", - fileUri: pendingData?.filepath || "unknown", - - // Empty/default values for fields we don't have. - completion: "", - prompt: "", - userEdits: "", - userExcerpts: "", - originalEditableRange: "", - workspaceDirUri: "", - cursorPosition: { line: -1, character: -1 }, - finalCursorPosition: { line: -1, character: -1 }, - editableRegionStartLine: -1, - editableRegionEndLine: -1, - diffLines: [], - completionOptions: {}, - }; - - this.logNextEditOutcome(minimalAbortOutcome as NextEditOutcome); } // Clean up. @@ -255,6 +217,9 @@ export class NextEditLoggingService { }); // const { prompt, completion, prefix, suffix, ...restOfOutcome } = outcome; + if (outcome.requestId && outcome.accepted !== undefined) { + void this.logAcceptReject(outcome.requestId, outcome.accepted); + } void Telemetry.capture("nextEditOutcome", outcome, true); } @@ -268,7 +233,7 @@ export class NextEditLoggingService { } const controlPlaneEnv = getControlPlaneEnvSync("production"); - await fetchwithRequestOptions( + const resp = await fetchwithRequestOptions( new URL("model-proxy/v1/feedback", controlPlaneEnv.CONTROL_PLANE_URL), { method: "POST", diff --git a/core/nextEdit/NextEditPrefetchQueue.ts b/core/nextEdit/NextEditPrefetchQueue.ts index ad35db3b9..d6af3598d 100644 --- a/core/nextEdit/NextEditPrefetchQueue.ts +++ b/core/nextEdit/NextEditPrefetchQueue.ts @@ -140,7 +140,7 @@ export class PrefetchQueue { const count = Math.min(3, this.processedQueue.length); const firstThree = this.processedQueue.slice(0, count); firstThree.forEach((item, index) => { - console.log( + console.debug( `Item ${index + 1}: ${item.location.range.start.line} to ${item.location.range.end.line}`, ); }); diff --git a/core/nextEdit/NextEditProvider.ts b/core/nextEdit/NextEditProvider.ts index 4d9216914..1150f5545 100644 --- a/core/nextEdit/NextEditProvider.ts +++ b/core/nextEdit/NextEditProvider.ts @@ -8,6 +8,7 @@ import { ContextRetrievalService } from "../autocomplete/context/ContextRetrieva import { BracketMatchingService } from "../autocomplete/filtering/BracketMatchingService.js"; import { CompletionStreamer } from "../autocomplete/generation/CompletionStreamer.js"; +import { postprocessCompletion } from "../autocomplete/postprocessing/index.js"; import { shouldPrefilter } from "../autocomplete/prefiltering/index.js"; import { getAllSnippetsWithoutRace } from "../autocomplete/snippets/index.js"; import { AutocompleteCodeSnippet } from "../autocomplete/snippets/types.js"; @@ -415,6 +416,7 @@ export class NextEditProvider { filePath: helper.filepath, diffType: DiffFormatType.Unified, contextLines: 3, + workspaceDir: workspaceDirs[0], // Use first workspace directory }), }; @@ -468,33 +470,53 @@ export class NextEditProvider { } // Extract completion using model-specific logic. - const nextCompletion = this.modelProvider.extractCompletion(msg.content); + let nextCompletion = this.modelProvider.extractCompletion(msg.content); + + // Postprocess the completion (same as autocomplete). + const postprocessed = postprocessCompletion({ + completion: nextCompletion, + llm, + prefix: helper.prunedPrefix, + suffix: helper.prunedSuffix, + }); + + // Return early if postprocessing filtered out the completion. + if (!postprocessed) { + return undefined; + } + + nextCompletion = postprocessed; let outcome: NextEditOutcome | undefined; // Handle based on diff type. + const profileType = + this.configHandler.currentProfile?.profileDescription.profileType; + if (opts?.usingFullFileDiff === false || !opts?.usingFullFileDiff) { - outcome = await this.modelProvider.handlePartialFileDiff( + outcome = await this.modelProvider.handlePartialFileDiff({ helper, editableRegionStartLine, editableRegionEndLine, startTime, llm, nextCompletion, - this.promptMetadata!, - this.ide, - ); + promptMetadata: this.promptMetadata!, + ide: this.ide, + profileType, + }); } else { - outcome = await this.modelProvider.handleFullFileDiff( + outcome = await this.modelProvider.handleFullFileDiff({ helper, editableRegionStartLine, editableRegionEndLine, startTime, llm, nextCompletion, - this.promptMetadata!, - this.ide, - ); + promptMetadata: this.promptMetadata!, + ide: this.ide, + profileType, + }); } if (outcome) { diff --git a/core/nextEdit/context/diffFormatting.ts b/core/nextEdit/context/diffFormatting.ts index 38a76b051..773b05805 100644 --- a/core/nextEdit/context/diffFormatting.ts +++ b/core/nextEdit/context/diffFormatting.ts @@ -1,4 +1,5 @@ import { createPatch } from "diff"; +import { getUriPathBasename } from "../../util/uri"; export enum DiffFormatType { Unified = "unified", @@ -18,6 +19,7 @@ export interface CreateDiffArgs { filePath: string; diffType: DiffFormatType; contextLines: number; + workspaceDir?: string; } export const createDiff = ({ @@ -26,6 +28,7 @@ export const createDiff = ({ filePath, diffType, contextLines, + workspaceDir, }: CreateDiffArgs) => { switch (diffType) { case DiffFormatType.Unified: @@ -34,6 +37,7 @@ export const createDiff = ({ afterContent, filePath, contextLines, + workspaceDir, ); case DiffFormatType.TokenLineDiff: return createTokenLineDiff(beforeContent, afterContent, filePath); @@ -46,6 +50,7 @@ const createUnifiedDiff = ( afterContent: string, filePath: string, contextLines: number, + workspaceDir?: string, ) => { const normalizedBefore = beforeContent.endsWith("\n") ? beforeContent @@ -54,12 +59,21 @@ const createUnifiedDiff = ( ? afterContent : afterContent + "\n"; + // Use relative path if workspace directory is provided + let displayPath = filePath; + if (workspaceDir && filePath.startsWith(workspaceDir)) { + displayPath = filePath.slice(workspaceDir.length).replace(/^[\/]/, ""); + } else if (workspaceDir) { + // Fallback to just the basename if we can't determine relative path + displayPath = getUriPathBasename(filePath); + } + const patch = createPatch( - filePath, + displayPath, normalizedBefore, normalizedAfter, - "before", - "after", + undefined, + undefined, { context: contextLines }, ); diff --git a/core/nextEdit/context/diffFormatting.vitest.ts b/core/nextEdit/context/diffFormatting.vitest.ts index b010f7837..889059037 100644 --- a/core/nextEdit/context/diffFormatting.vitest.ts +++ b/core/nextEdit/context/diffFormatting.vitest.ts @@ -127,6 +127,72 @@ describe("diffFormatting", () => { expect(result).toContain("@@ -4,5 +4,5 @@"); }); + + it("should use relative path when workspaceDir is provided", () => { + const args: CreateDiffArgs = { + beforeContent, + afterContent, + filePath: "file:///workspace/project/src/test.js", + diffType: DiffFormatType.Unified, + contextLines: 3, + workspaceDir: "file:///workspace/project", + }; + + const result = createDiff(args); + + expect(result).toContain("--- src/test.js"); + expect(result).toContain("+++ src/test.js"); + expect(result).not.toContain("file://"); + expect(result).not.toContain("/workspace/project"); + }); + + it("should handle workspaceDir with trailing slash", () => { + const args: CreateDiffArgs = { + beforeContent, + afterContent, + filePath: "file:///workspace/project/src/test.js", + diffType: DiffFormatType.Unified, + contextLines: 3, + workspaceDir: "file:///workspace/project/", + }; + + const result = createDiff(args); + + expect(result).toContain("--- src/test.js"); + expect(result).toContain("+++ src/test.js"); + }); + + it("should fallback to basename when path not in workspace", () => { + const args: CreateDiffArgs = { + beforeContent, + afterContent, + filePath: "file:///other/location/test.js", + diffType: DiffFormatType.Unified, + contextLines: 3, + workspaceDir: "file:///workspace/project", + }; + + const result = createDiff(args); + + expect(result).toContain("--- test.js"); + expect(result).toContain("+++ test.js"); + }); + + it("should use full path when no workspaceDir provided", () => { + const fullPath = "file:///workspace/project/src/test.js"; + const args: CreateDiffArgs = { + beforeContent, + afterContent, + filePath: fullPath, + diffType: DiffFormatType.Unified, + contextLines: 3, + }; + + const result = createDiff(args); + + expect(result).toContain(`--- ${fullPath}`); + expect(result).toContain(`+++ ${fullPath}`); + }); }); describe("createBeforeAfterDiff", () => { diff --git a/core/nextEdit/context/processNextEditData.ts b/core/nextEdit/context/processNextEditData.ts index 2aa4adb79..8b6e41a82 100644 --- a/core/nextEdit/context/processNextEditData.ts +++ b/core/nextEdit/context/processNextEditData.ts @@ -140,6 +140,7 @@ export const processNextEditData = async ({ filePath: filePath, diffType: DiffFormatType.Unified, contextLines: 25, // storing many context lines for downstream trimming + workspaceDir: workspaceDir, }), fileUri: filePath, workspaceUri: workspaceDir, diff --git a/core/nextEdit/context/processSmallEdit.ts b/core/nextEdit/context/processSmallEdit.ts index a98233cfe..c2fc85786 100644 --- a/core/nextEdit/context/processSmallEdit.ts +++ b/core/nextEdit/context/processSmallEdit.ts @@ -14,16 +14,6 @@ export const processSmallEdit = async ( getDefsFromLspFunction: GetLspDefinitionsFunction, ide: IDE, ) => { - NextEditProvider.getInstance().addDiffToContext( - createDiff({ - beforeContent: beforeAfterdiff.beforeContent, - afterContent: beforeAfterdiff.afterContent, - filePath: beforeAfterdiff.filePath, - diffType: DiffFormatType.Unified, - contextLines: 5, // NOTE: This can change depending on experiments! - }), - ); - // Get the current context data from the most recent message const currentData = (EditAggregator.getInstance() as any) .latestContextData || { @@ -33,6 +23,17 @@ export const processSmallEdit = async ( recentlyVisitedRanges: [], }; + NextEditProvider.getInstance().addDiffToContext( + createDiff({ + beforeContent: beforeAfterdiff.beforeContent, + afterContent: beforeAfterdiff.afterContent, + filePath: beforeAfterdiff.filePath, + diffType: DiffFormatType.Unified, + contextLines: 3, // NOTE: This can change depending on experiments! + workspaceDir: currentData.workspaceDir, + }), + ); + void processNextEditData({ filePath: beforeAfterdiff.filePath, beforeContent: beforeAfterdiff.beforeContent, diff --git a/core/nextEdit/providers/BaseNextEditProvider.ts b/core/nextEdit/providers/BaseNextEditProvider.ts index 4eb601fd9..0c8fa2f62 100644 --- a/core/nextEdit/providers/BaseNextEditProvider.ts +++ b/core/nextEdit/providers/BaseNextEditProvider.ts @@ -47,16 +47,28 @@ export abstract class BaseNextEditModelProvider { }; // Methods that can be used as default fallback. - public async handlePartialFileDiff( - helper: HelperVars, - editableRegionStartLine: number, - editableRegionEndLine: number, - startTime: number, - llm: ILLM, - nextCompletion: string, - promptMetadata: PromptMetadata, - ide: IDE, - ): Promise { + public async handlePartialFileDiff(params: { + helper: HelperVars; + editableRegionStartLine: number; + editableRegionEndLine: number; + startTime: number; + llm: ILLM; + nextCompletion: string; + promptMetadata: PromptMetadata; + ide: IDE; + profileType?: "local" | "platform" | "control-plane"; + }): Promise { + const { + helper, + editableRegionStartLine, + editableRegionEndLine, + startTime, + llm, + nextCompletion, + promptMetadata, + ide, + profileType, + } = params; const oldEditRangeSlice = helper.fileContents .split("\n") .slice(editableRegionStartLine, editableRegionEndLine + 1) @@ -83,21 +95,34 @@ export abstract class BaseNextEditModelProvider { originalEditableRange: oldEditRangeSlice, diffLines: [], ide, + profileType, }); return outcome; } - public async handleFullFileDiff( - helper: HelperVars, - editableRegionStartLine: number, - editableRegionEndLine: number, - startTime: number, - llm: ILLM, - nextCompletion: string, - promptMetadata: PromptMetadata, - ide: IDE, - ): Promise { + public async handleFullFileDiff(params: { + helper: HelperVars; + editableRegionStartLine: number; + editableRegionEndLine: number; + startTime: number; + llm: ILLM; + nextCompletion: string; + promptMetadata: PromptMetadata; + ide: IDE; + profileType?: "local" | "platform" | "control-plane"; + }): Promise { + const { + helper, + editableRegionStartLine, + editableRegionEndLine, + startTime, + llm, + nextCompletion, + promptMetadata, + ide, + profileType, + } = params; const fileSlice = helper.fileLines .slice(editableRegionStartLine, editableRegionEndLine + 1) .join("\n"); @@ -111,7 +136,7 @@ export abstract class BaseNextEditModelProvider { const currentLine = helper.pos.line; const prefetchQueue = PrefetchQueue.getInstance(); - const cursorLocalDiffGroup = await this.processDiffGroups( + const cursorLocalDiffGroup = await this.processDiffGroups({ diffGroups, currentLine, helper, @@ -120,19 +145,21 @@ export abstract class BaseNextEditModelProvider { prefetchQueue, promptMetadata, ide, - ); + profileType, + }); if (cursorLocalDiffGroup) { - return await this.createOutcomeFromDiffGroup( - cursorLocalDiffGroup, + return await this.createOutcomeFromDiffGroup({ + diffGroup: cursorLocalDiffGroup, helper, startTime, llm, - helper.input.completionId, - true, + completionId: helper.input.completionId, + isCurrentCursorGroup: true, promptMetadata, ide, - ); + profileType, + }); } return undefined; @@ -141,23 +168,35 @@ export abstract class BaseNextEditModelProvider { /** * Process diff groups and find the one containing the cursor. */ - private async processDiffGroups( - diffGroups: DiffGroup[], - currentLine: number, - helper: HelperVars, - startTime: number, - llm: ILLM, - prefetchQueue: PrefetchQueue, - promptMetadata: PromptMetadata, - ide: IDE, - ): Promise { + private async processDiffGroups(params: { + diffGroups: DiffGroup[]; + currentLine: number; + helper: HelperVars; + startTime: number; + llm: ILLM; + prefetchQueue: PrefetchQueue; + promptMetadata: PromptMetadata; + ide: IDE; + profileType?: "local" | "platform" | "control-plane"; + }): Promise { + const { + diffGroups, + currentLine, + helper, + startTime, + llm, + prefetchQueue, + promptMetadata, + ide, + profileType, + } = params; let cursorGroup: DiffGroup | undefined; for (const group of diffGroups) { if (currentLine >= group.startLine && currentLine <= group.endLine) { cursorGroup = group; } else { - await this.addDiffGroupToPrefetchQueue( + await this.addDiffGroupToPrefetchQueue({ group, helper, startTime, @@ -165,22 +204,34 @@ export abstract class BaseNextEditModelProvider { prefetchQueue, promptMetadata, ide, - ); + profileType, + }); } } return cursorGroup; } - private async addDiffGroupToPrefetchQueue( - group: DiffGroup, - helper: HelperVars, - startTime: number, - llm: ILLM, - prefetchQueue: PrefetchQueue, - promptMetadata: PromptMetadata, - ide: IDE, - ): Promise { + private async addDiffGroupToPrefetchQueue(params: { + group: DiffGroup; + helper: HelperVars; + startTime: number; + llm: ILLM; + prefetchQueue: PrefetchQueue; + promptMetadata: PromptMetadata; + ide: IDE; + profileType?: "local" | "platform" | "control-plane"; + }): Promise { + const { + group, + helper, + startTime, + llm, + prefetchQueue, + promptMetadata, + ide, + profileType, + } = params; // Extract lines that are not old. const groupContent = group.lines .filter((l) => l.type !== "old") @@ -223,6 +274,7 @@ export abstract class BaseNextEditModelProvider { completionId: uuidv4(), // Generate a new ID for this prefetched item. diffLines: group.lines, ide, + profileType, }); prefetchQueue.enqueueProcessed({ @@ -231,16 +283,28 @@ export abstract class BaseNextEditModelProvider { }); } - private async createOutcomeFromDiffGroup( - diffGroup: DiffGroup, - helper: HelperVars, - startTime: number, - llm: ILLM, - completionId: string, - isCurrentCursorGroup: boolean, - promptMetadata: PromptMetadata, - ide: IDE, - ): Promise { + private async createOutcomeFromDiffGroup(params: { + diffGroup: DiffGroup; + helper: HelperVars; + startTime: number; + llm: ILLM; + completionId: string; + isCurrentCursorGroup: boolean; + promptMetadata: PromptMetadata; + ide: IDE; + profileType?: "local" | "platform" | "control-plane"; + }): Promise { + const { + diffGroup, + helper, + startTime, + llm, + completionId, + isCurrentCursorGroup, + promptMetadata, + ide, + profileType, + } = params; const groupContent = diffGroup.lines .filter((l) => l.type !== "old") .map((l) => l.line) @@ -278,6 +342,7 @@ export abstract class BaseNextEditModelProvider { completionId, diffLines: diffGroup.lines, ide, + profileType, }); return outcomeNext; @@ -299,6 +364,7 @@ export abstract class BaseNextEditModelProvider { completionId?: string; diffLines: DiffLine[]; ide: IDE; + profileType?: "local" | "platform" | "control-plane"; }): Promise { return { elapsed: Date.now() - outcomeCtx.startTime, @@ -325,6 +391,7 @@ export abstract class BaseNextEditModelProvider { editableRegionStartLine: outcomeCtx.editableRegionStartLine, editableRegionEndLine: outcomeCtx.editableRegionEndLine, diffLines: outcomeCtx.diffLines, + profileType: outcomeCtx.profileType, ...outcomeCtx.helper.options, }; } diff --git a/core/nextEdit/types.ts b/core/nextEdit/types.ts index 2e6c8d40b..2d742c697 100644 --- a/core/nextEdit/types.ts +++ b/core/nextEdit/types.ts @@ -68,6 +68,7 @@ export interface NextEditOutcome extends TabAutocompleteOptions { editableRegionStartLine: number; editableRegionEndLine: number; diffLines: DiffLine[]; + profileType?: "local" | "platform" | "control-plane"; } export interface PromptMetadata { diff --git a/extensions/vscode/src/autocomplete/GhostTextAcceptanceTracker.ts b/extensions/vscode/src/autocomplete/GhostTextAcceptanceTracker.ts index fbb4ac8ae..271e3342d 100644 --- a/extensions/vscode/src/autocomplete/GhostTextAcceptanceTracker.ts +++ b/extensions/vscode/src/autocomplete/GhostTextAcceptanceTracker.ts @@ -135,7 +135,7 @@ export class GhostTextAcceptanceTracker { ); if (wasGhostTextAccepted) { - console.log( + console.debug( "GhostTextAcceptanceTracker: ghost text was accepted, preserving chain", ); return true; diff --git a/extensions/vscode/src/util/editLoggingUtils.ts b/extensions/vscode/src/util/editLoggingUtils.ts index 767131868..467ab4f0f 100644 --- a/extensions/vscode/src/util/editLoggingUtils.ts +++ b/extensions/vscode/src/util/editLoggingUtils.ts @@ -3,9 +3,6 @@ import { AutocompleteCodeSnippet } from "core/autocomplete/snippets/types"; import { GetLspDefinitionsFunction } from "core/autocomplete/types"; import { ConfigHandler } from "core/config/ConfigHandler"; import { RecentlyEditedRange } from "core/nextEdit/types"; -import { getContinueGlobalPath, isFileWithinFolder } from "core/util/paths"; -import fs from "fs"; -import { resolve } from "path"; import * as vscode from "vscode"; import { ContinueCompletionProvider } from "../autocomplete/completionProvider"; @@ -21,23 +18,6 @@ export const getBeforeCursorPos = (range: Range, activePos: Position) => { } }; -const isEditLoggingAllowed = async (editedFileURI: string) => { - const globalContinuePath = getContinueGlobalPath(); - const editLogDirsPath = resolve(globalContinuePath, ".editlogdirs"); - - try { - const fileContent = await fs.promises.readFile(editLogDirsPath, "utf-8"); - const stringItems = fileContent - .split("\n") - .map((line) => line.trim()) - .filter((line) => line.length > 0); - - return stringItems.some((dir) => isFileWithinFolder(editedFileURI, dir)); - } catch (error) { - return false; - } -}; - const getWorkspaceDirUri = async (event: vscode.TextDocumentChangeEvent) => { const workspaceFolder = vscode.workspace.getWorkspaceFolder( event.document.uri, @@ -68,7 +48,6 @@ export const handleTextDocumentChange = async ( // Ensure that logging will only happen in the open-source continue repo const workspaceDirUri = await getWorkspaceDirUri(event); if (!workspaceDirUri) return; - if (!(await isEditLoggingAllowed(event.document.uri.toString()))) return; const activeCursorPos = editor.selection.active; const editActions: RangeInFileWithNextEditInfo[] = changes.map((change) => ({ From 83478315d9b6f3a6da8c43c3103d91ecb4d3e3b7 Mon Sep 17 00:00:00 2001 From: Ting-Wai <40179554+tingwai@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:34:00 -0700 Subject: [PATCH 40/42] chore: bump VSCode extension version to 1.3.16 (#8147) --- 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 ceb04abc0..cd5b03c10 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": "1.3.15", + "version": "1.3.16", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 12a2acd874a916afae793576127e62abd9925925 Mon Sep 17 00:00:00 2001 From: BekahHW <34313413+BekahHW@users.noreply.github.com> Date: Wed, 8 Oct 2025 21:30:58 -0400 Subject: [PATCH 41/42] feat: notion cookbook (#8074) * Add notion cookbook * Add notion draft * Add draft notion cookbook * Update docs/guides/notion-continue-cookbook.mdx Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * Change cookbook to guide using API since MCP doesn't work * Move out of MCP cookbooks in overview * Apply suggestion from @cubic-dev-ai[bot] Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Brian Douglas --- docs/docs.json | 3 +- docs/guides/notion-continue-guide.mdx | 377 ++++++++++++++++++++++++++ docs/guides/overview.mdx | 1 + 3 files changed, 380 insertions(+), 1 deletion(-) create mode 100644 docs/guides/notion-continue-guide.mdx diff --git a/docs/docs.json b/docs/docs.json index 27282b5d7..4c69ea6ea 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -258,7 +258,8 @@ "guides/instinct", "guides/running-continue-without-internet", "guides/custom-code-rag", - "guides/how-to-self-host-a-model" + "guides/how-to-self-host-a-model", + "guides/notion-continue-guide" ] }, { diff --git a/docs/guides/notion-continue-guide.mdx b/docs/guides/notion-continue-guide.mdx new file mode 100644 index 000000000..b1dc4227b --- /dev/null +++ b/docs/guides/notion-continue-guide.mdx @@ -0,0 +1,377 @@ +--- +title: "Developer & Team Workflows with Notion + Continue CLI" +description: "Use Continue CLI with Notion to generate docs, manage tasks, and automate project workflows – all through natural-language prompts." +sidebarTitle: "Notion with Continue" +--- + + + + A workflow that lets you query, update, and create Notion pages or database + entries from natural-language prompts. Generate PRDs, sprint tasks, meeting + notes, or status reports automatically – perfect for individual developers + and cross-functional teams. + + + +## What You'll Learn + +This guide teaches you to: +- Use natural language to connect to the Notion API directly with Continue CLI for powerful automation +- Configure Notion API access with proper permissions and security +- Run prompts in both TUI (interactive) and headless modes +- Create automated workflows that generate docs, manage tasks, and sync data + +## Prerequisites + +Before starting, ensure you have: + +- [Continue CLI](https://docs.continue.dev/cli/overview) installed (`npm i -g @continuedev/cli`) +- A [Notion workspace](https://notion.so) with Editor (or higher) access +- Node.js 18+ installed locally +- [Continue account](https://hub.continue.dev) with **Hub access** + + + + **Agent usage requires credits** – create a Continue API key at + [hub.continue.dev/settings/api-keys](https://hub.continue.dev/settings/api-keys) + and store it as a secret. + + + + + + ```bash + npm i -g @continuedev/cli + ``` + Verify installation: + ```bash + cn --version + ``` + + + + 1. Go to **[Notion Integrations](https://www.notion.so/my-integrations)** + 2. Click **+ New integration** → give it a name (e.g. "Continue Integration") + 3. Select your workspace + 4. Under **Content Capabilities**, enable: + - ✅ Read content + - ✅ Update content + - ✅ Insert content + 5. Under **Comment Capabilities**, enable: + - ✅ Read comments + - ✅ Insert comments + 6. Under **User Capabilities**, select: + - ✅ Read user information including email addresses + 7. Click **Submit** and copy the **Internal Integration Secret** (starts with `secret_`) + + + + This token is your `NOTION_API_KEY`. + Keep it safe – you won't be able to view it again. + + + + 8. In Notion, open each database or top-level page you want accessible → **Share** → **Invite** your new integration → **Full access**. + + + + Set your Notion API key as an environment variable in your terminal: + + ```bash + export NOTION_API_KEY="secret_xxx" + ``` + + + + Running this command sets your API key for the current terminal session only. + When you close the terminal, the variable won't persist. To test your API key, run the curl command below in the same session. + + ```bash + curl -H "Authorization: Bearer $NOTION_API_KEY" \ + -H "Notion-Version: 2022-06-28" \ + https://api.notion.com/v1/databases + ``` + + + + + Depending on what you want `cn` to accomplish, you'll need to add your Notion workspace keys to the terminal session. The workspace key is your Notion database ID. Run the following command: + + ```bash + export NOTION_DATABASE_ID="your_database_id" + ``` + + + You can find your database ID by: + 1. Opening your Notion changelog database + 2. Looking at the URL - it will be something like: + https://www.notion.so/your-workspace/DATABASE_ID?v=... + 3. The DATABASE_ID is the long string of characters between the last / and the ? + + + + + +## Running Continue AI Agent with Notion API + + + + Continue CLI offers two powerful modes for Notion automation: + **TUI mode** for interactive workflows and **Headless mode** for automated scripts. + + + + + + + + + Navigate to your project directory and run: + ```bash + cn + ``` + + + + In the TUI interface, enter: + ``` + 1. Fetch my Notion databases using the Notion API key + and Database ID stored in this terminal session. + 2. Look at the last week of Merged GitHub PRs, and create + a changelog entry in Notion summarizing the features and breaking changes. + ``` + + + + TUI mode lets you review and approve each action before execution, + perfect for learning and debugging. + + + + + + + + + + Execute prompts directly from the command line: + ```bash + cn -p --auto " + 1. Fetch my Notion databases using the Notion API key + and Database ID stored in this terminal session. + 2. Analyze all merged GitHub PRs from the past week. + 3. Extract feature descriptions and breaking changes. + 4. Create a technical changelog in Notion with PR links." + ``` + + **Flags explained:** + - `-p`: Run without TUI interface + - `--auto`: Execute without manual approval + + + + Always test prompts in TUI mode first before running + them with `--auto` in production. + + + + + + + + + + - Environment variable `NOTION_API_KEY` must be set before running Continue CLI + - Continue automatically uses the API key to authenticate with Notion + - No need for manual curl commands - just reference "the API key stored in this session" + - For complex workflows, Continue maintains the API connection throughout + - Consider creating aliases or scripts for frequently used prompts + + + +--- + +## Quick Start Example + +Working example that demonstrates the power of Continue with Notion API: + + + + **This exact command has been tested and works:** + + ```bash + # Weekly Sprint Summary + cn -p --auto " + 1. Fetch Notion Sprint database + 2. Analyze completed tasks vs planned + 3. Generate sprint retrospective page + 4. Add velocity metrics and burndown chart" + ``` + + **What this does:** + 1. Connects to your Notion workspace using the API key + 2. Analyzes your sprint data + 3. Calculates completion metrics + 4. Creates a comprehensive retrospective with visualizations + + + + +## Example Prompts & Workflows + +With the Notion API configured, you can use natural language prompts to automate your workspace. Here are examples for both TUI and headless modes: + + + + **TUI Mode:** + ```bash + cn " + 1. Fetch my Notion databases using the API key and secrets stored in this session + 2. Generate API documentation for all endpoints + in src/api/routes with request/response schemas + 3. Create a page in Technical Docs database + " + ``` + + **Headless Mode:** + ```bash + cn -p --auto "Fetch my Notion databases using the API key and secrets stored in this session. Generate API docs + for src/api/routes and save to Notion in Technical Docs database" + ``` + + + + **Headless Mode (Automated):** + ```bash + cn -p --auto " + 1. Fetch my Notion databases using the API key stored in this session + 2. Scan codebase for TODO and FIXME comments + 3. Create tasks in my Notion Engineering Backlog database + 4. Include file paths and complexity estimates" + ``` + + + + ```bash + cn -p --auto " + 1. Fetch my Notion databases using the API key stored in this session + 2. Analyze all merged GitHub PRs from past month + 3. In my Notion Launch Database, review the Launch Template. + 4. Create an October Launch doc in Notion with a week of launches and materials based on the Launch documents based on the PR analysis and launch documents." + ``` + + + + + ```bash + cn -p --auto " + 1. Fetch my Tasks database from Notion using the API key + 2. Find tasks completed yesterday + 3. Find tasks in progress + 4. Create standup note with: completed, + in-progress, and blockers sections" + ``` + + + +## Advanced Workflows + + + + ```bash + cn -p --auto " + 1. Connect to Notion using the API key in this session + 2. Get merged PRs from last 7 days using GitHub + 3. Extract feature descriptions and changes + 4. Create formatted changelog in Notion + 5. Add links back to GitHub PRs" + ``` + + + + Requires GitHub repository access. To add GitHub access, update your [integration settings](https://hub.continue.dev/settings/integrations). + + + + + + ```bash + cn -p --auto " + 1. Connect to Notion using the API key in this session + 2. Run test coverage report (npm test -- --coverage) + 3. Parse coverage metrics + 4. Update Test Metrics database in Notion + 5. Flag files with coverage below 80%" + ``` + + + + ```bash + cn " + 1. Connect to Notion using the API key in this session + 2. In my Blog Posts Database, find drafts tagged 'Review' + 3. Review all blog posts for grammar and clarity and suggest improvements through comments. + ``` + + + + ```bash + cn -p --auto " + 1. Connect to Notion databases using API key + 2. Aggregate completed tasks from the week + 3. Calculate velocity and burndown metrics + 4. Generate weekly report with charts + 5. Share link in Slack #team-updates" + ``` + + + +## Security Best Practices + + + + **Protect Your API Keys:** + - Never commit `NOTION_API_KEY` to version control + - Use environment variables or secure secret managers + - Rotate API keys every 90 days + - Grant integration access only to required databases/pages + - Monitor API usage through Notion's integration dashboard + - Use `.env` files with `.gitignore` for local development + + + + +## Next Steps + +- Create a **GitHub Actions** workflow to automate changelog generation on releases +- Build a **daily standup bot** that runs every morning and posts to Slack +- Set up **database templates** in Notion for consistent formatting +- Explore **batch operations** to update multiple pages efficiently +- Implement **error handling** for API rate limits and network issues + +--- + +## Troubleshooting + + + + **API Key Not Found:** + - Ensure `NOTION_API_KEY` is exported in your current shell session + - Check for typos in the environment variable name + - Verify the key starts with `secret_` + + **Database Access Denied:** + - Share the specific database with your integration in Notion + - Ensure the integration has the correct permissions (Read, Write, Insert) + + **Connection Issues:** + - Verify Continue CLI has internet access + - Check network connectivity to api.notion.com + - Ensure your Notion workspace allows API access + + **Rate Limiting:** + - Notion API has rate limits (3 requests per second) + - Implement exponential backoff for automated scripts + - Consider batching operations when possible + + diff --git a/docs/guides/overview.mdx b/docs/guides/overview.mdx index 8c95a5397..e4eb77ccf 100644 --- a/docs/guides/overview.mdx +++ b/docs/guides/overview.mdx @@ -14,6 +14,7 @@ description: "Comprehensive collection of practical guides for Continue includin - [Continuous AI: A Developer's Guide](/guides/continuous-ai) - Integrating AI into development workflows - [How to Use Continue CLI (cn)](/guides/cli) - Command-line interface for Continue - [Continuous AI Readiness Assessment](/guides/continuous-ai-readiness-assessment) - Evaluate team readiness for Continuous AI adoption +- [Notion + Continue Guide](/guides/notion-continue-guide) - Automate docs, tasks, and release workflows ## MCP Integration Cookbooks From 8b10f1dd46222b10759cce445644a6f4baabcfad Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Wed, 8 Oct 2025 22:08:17 -0700 Subject: [PATCH 42/42] feat: asciinema recordings setup (#8154) --- .../workflows/runloop-blueprint-template.json | 3 +- extensions/cli/.gitignore | 3 ++ extensions/cli/demo.expect | 36 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 extensions/cli/demo.expect diff --git a/.github/workflows/runloop-blueprint-template.json b/.github/workflows/runloop-blueprint-template.json index d0fcf57c1..244897cdd 100644 --- a/.github/workflows/runloop-blueprint-template.json +++ b/.github/workflows/runloop-blueprint-template.json @@ -3,6 +3,7 @@ "system_setup_commands": [ "npm i -g @continuedev/cli@latest", "sudo apt update", - "sudo apt install -y ripgrep" + "sudo apt install -y ripgrep", + "sudo apt install asciinema" ] } diff --git a/extensions/cli/.gitignore b/extensions/cli/.gitignore index dc3410527..f3e655274 100644 --- a/extensions/cli/.gitignore +++ b/extensions/cli/.gitignore @@ -11,3 +11,6 @@ chat.log config.yaml .continue-debug/ + +*.expect +!demo.expect \ No newline at end of file diff --git a/extensions/cli/demo.expect b/extensions/cli/demo.expect new file mode 100644 index 000000000..e762df796 --- /dev/null +++ b/extensions/cli/demo.expect @@ -0,0 +1,36 @@ +#!/usr/bin/expect -f +# Automated demo script for Continue TUI + +set timeout 30 +log_user 1 + +# Set terminal environment for better TUI rendering +set env(TERM) "xterm-256color" + +# Spawn cn directly inside an asciinema recording session +spawn bash -c "asciinema rec --overwrite demo.cast -c 'npm run start'" + +# Wait for TUI to load +sleep 5 + +# Demo interaction 1: Show help +send "?" +sleep 3 + +# Demo interaction 2: Close help +send "?" +sleep 2 + +# Demo interaction 3: Type a message +send "Hello, this is a demo!" +sleep 1 + +# Submit the message +send "\r" +sleep 3 + +# Exit the application with Ctrl+C +send "\x03" +sleep 1 + +expect eof