Changesets · Branches · Tags · Compare
| Changeset | 2341a2a49c81c53b0ea9b5e72b208ba72e9804f0b745590bc59c00691cdb09cb |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-07-17 18:46 +02:00 |
| Committer | GitHub <noreply@github.com> · 2025-07-17 18:46 +02:00 |
| Parents | c10bddf80ff0, 9e76bdcc19c2 |
10 files changed
modified core/config/ConfigHandler.ts +3 −0
| @@ -65,9 +65,11 @@ | ||
| 65 | 65 | ) { |
| 66 | 66 | this.ide = ide; |
| 67 | 67 | this.ideSettingsPromise = ideSettingsPromise; |
| 68 | + | |
| 68 | 69 | this.controlPlaneClient = new ControlPlaneClient( |
| 69 | 70 | sessionInfoPromise, |
| 70 | 71 | ideSettingsPromise, |
| 72 | + this.ide.getIdeInfo(), | |
| 71 | 73 | ); |
| 72 | 74 | |
| 73 | 75 | // This profile manager will always be available |
| @@ -364,6 +366,7 @@ | ||
| 364 | 366 | this.controlPlaneClient = new ControlPlaneClient( |
| 365 | 367 | Promise.resolve(sessionInfo), |
| 366 | 368 | this.ideSettingsPromise, |
| 369 | + this.ide.getIdeInfo(), | |
| 367 | 370 | ); |
| 368 | 371 | this.abortCascade(); |
| 369 | 372 | await this.cascadeInit("Control plane session info update"); |
modified core/control-plane/client.ts +8 −1
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | import fetch, { RequestInit, Response } from "node-fetch"; |
| 11 | 11 | |
| 12 | 12 | import { OrganizationDescription } from "../config/ProfileLifecycleManager.js"; |
| 13 | -import { IdeSettings, ModelDescription } from "../index.js"; | |
| 13 | +import { IdeInfo, IdeSettings, ModelDescription } from "../index.js"; | |
| 14 | 14 | |
| 15 | 15 | import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js"; |
| 16 | 16 | import { getControlPlaneEnv } from "./env.js"; |
| @@ -40,6 +40,7 @@ | ||
| 40 | 40 | ControlPlaneSessionInfo | undefined |
| 41 | 41 | >, |
| 42 | 42 | private readonly ideSettingsPromise: Promise<IdeSettings>, |
| 43 | + private readonly ideInfoPromise: Promise<IdeInfo>, | |
| 43 | 44 | ) {} |
| 44 | 45 | |
| 45 | 46 | async resolveFQSNs( |
| @@ -86,11 +87,17 @@ | ||
| 86 | 87 | |
| 87 | 88 | const env = await getControlPlaneEnv(this.ideSettingsPromise); |
| 88 | 89 | const url = new URL(path, env.CONTROL_PLANE_URL).toString(); |
| 90 | + const ideInfo = await this.ideInfoPromise; | |
| 91 | + | |
| 89 | 92 | const resp = await fetch(url, { |
| 90 | 93 | ...init, |
| 91 | 94 | headers: { |
| 92 | 95 | ...init.headers, |
| 93 | 96 | Authorization: `Bearer ${accessToken}`, |
| 97 | + ...{ | |
| 98 | + "x-extension-version": ideInfo.extensionVersion, | |
| 99 | + "x-is-prerelease": String(ideInfo.isPrerelease), | |
| 100 | + }, | |
| 94 | 101 | }, |
| 95 | 102 | }); |
| 96 | 103 |
modified core/index.d.ts +1 −0
| @@ -711,6 +711,7 @@ | ||
| 711 | 711 | version: string; |
| 712 | 712 | remoteName: string; |
| 713 | 713 | extensionVersion: string; |
| 714 | + isPrerelease: boolean; | |
| 714 | 715 | } |
| 715 | 716 | |
| 716 | 717 | export interface BranchAndDir { |
modified core/test/fixtures.ts +1 −0
| @@ -13,6 +13,7 @@ | ||
| 13 | 13 | export const testControlPlaneClient = new ControlPlaneClient( |
| 14 | 14 | Promise.resolve(undefined), |
| 15 | 15 | ideSettingsPromise, |
| 16 | + testIde.getIdeInfo(), | |
| 16 | 17 | ); |
| 17 | 18 | |
| 18 | 19 | export const testConfigHandler = new ConfigHandler( |
modified core/util/filesystem.ts +1 −0
| @@ -120,6 +120,7 @@ | ||
| 120 | 120 | version: "0.1", |
| 121 | 121 | remoteName: "na", |
| 122 | 122 | extensionVersion: "na", |
| 123 | + isPrerelease: false, | |
| 123 | 124 | }); |
| 124 | 125 | } |
| 125 | 126 |
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +3 −2
| @@ -1,3 +1,4 @@ | ||
| 1 | + | |
| 1 | 2 | package com.github.continuedev.continueintellijextension.`continue` |
| 2 | 3 | |
| 3 | 4 | import com.github.continuedev.continueintellijextension.* |
| @@ -86,7 +87,8 @@ | ||
| 86 | 87 | name = ideName, |
| 87 | 88 | version = ideVersion, |
| 88 | 89 | remoteName = remoteName, |
| 89 | - extensionVersion = extensionVersion | |
| 90 | + extensionVersion = extensionVersion, | |
| 91 | + isPrerelease = false // TODO: Implement prerelease detection for JetBrains | |
| 90 | 92 | ) |
| 91 | 93 | } |
| 92 | 94 | |
| @@ -623,4 +625,3 @@ | ||
| 623 | 625 | } |
| 624 | 626 | |
| 625 | 627 | } |
| 626 | - |
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt +2 −1
| @@ -30,7 +30,8 @@ | ||
| 30 | 30 | val name: String, |
| 31 | 31 | val version: String, |
| 32 | 32 | val remoteName: String, |
| 33 | - val extensionVersion: String | |
| 33 | + val extensionVersion: String, | |
| 34 | + val isPrerelease: Boolean | |
| 34 | 35 | ) |
| 35 | 36 | |
| 36 | 37 | data class Problem( |
modified extensions/vscode/src/VsCodeIde.ts +3 −3
| @@ -27,6 +27,7 @@ | ||
| 27 | 27 | TerminalOptions, |
| 28 | 28 | Thread, |
| 29 | 29 | } from "core"; |
| 30 | +import { getExtensionVersion, isExtensionPrerelease } from "./util/util"; | |
| 30 | 31 | |
| 31 | 32 | class VsCodeIde implements IDE { |
| 32 | 33 | ideUtils: VsCodeIdeUtils; |
| @@ -153,9 +154,8 @@ | ||
| 153 | 154 | name: vscode.env.appName, |
| 154 | 155 | version: vscode.version, |
| 155 | 156 | remoteName: vscode.env.remoteName || "local", |
| 156 | - extensionVersion: | |
| 157 | - vscode.extensions.getExtension("continue.continue")?.packageJSON | |
| 158 | - .version, | |
| 157 | + extensionVersion: getExtensionVersion(), | |
| 158 | + isPrerelease: isExtensionPrerelease(), | |
| 159 | 159 | }); |
| 160 | 160 | } |
| 161 | 161 |
modified extensions/vscode/src/util/util.ts +12 −0
| @@ -126,3 +126,15 @@ | ||
| 126 | 126 | export function getvsCodeUriScheme(): string { |
| 127 | 127 | return vscode.env.uriScheme; |
| 128 | 128 | } |
| 129 | + | |
| 130 | +export function isExtensionPrerelease(): boolean { | |
| 131 | + const extensionVersion = getExtensionVersion(); | |
| 132 | + const versionParts = extensionVersion.split("."); | |
| 133 | + if (versionParts.length >= 2) { | |
| 134 | + const minorVersion = parseInt(versionParts[1], 10); | |
| 135 | + if (!isNaN(minorVersion)) { | |
| 136 | + return minorVersion % 2 !== 0; | |
| 137 | + } | |
| 138 | + } | |
| 139 | + return false; | |
| 140 | +} |
added extensions/vscode/src/util/util.vitest.ts +26 −0
| @@ -0,0 +1,26 @@ | ||
| 1 | +import { expect, test, vi } from "vitest"; | |
| 2 | +import * as vscode from "vscode"; | |
| 3 | + | |
| 4 | +// Mock the vscode module | |
| 5 | +vi.mock("vscode", () => ({ | |
| 6 | + extensions: { | |
| 7 | + getExtension: vi.fn(), | |
| 8 | + }, | |
| 9 | +})); | |
| 10 | + | |
| 11 | +// Import the function after mocking | |
| 12 | +import { isExtensionPrerelease } from "./util"; | |
| 13 | + | |
| 14 | +test("isExtensionPrerelease detects prerelease versions correctly", () => { | |
| 15 | + // 1.0.0 is not prerelease (even minor version) | |
| 16 | + vi.mocked(vscode.extensions.getExtension).mockReturnValue({ | |
| 17 | + packageJSON: { version: "1.0.0" }, | |
| 18 | + } as any); | |
| 19 | + expect(isExtensionPrerelease()).toBe(false); | |
| 20 | + | |
| 21 | + // 1.1.0 is prerelease (odd minor version) | |
| 22 | + vi.mocked(vscode.extensions.getExtension).mockReturnValue({ | |
| 23 | + packageJSON: { version: "1.1.0" }, | |
| 24 | + } as any); | |
| 25 | + expect(isExtensionPrerelease()).toBe(true); | |
| 26 | +}); |