Merge pull request #4153 from continuedev/nate/staging-env

Nate/staging-env
This commit is contained in:
Nate Sesti 2025-02-13 23:45:17 -08:00 • committed by GitHub
commit 8c697cc8ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 93 additions and 67 deletions

View file

@ -142,6 +142,10 @@ export class ConfigHandler {
let renderedConfig: AssistantUnrolled | undefined = undefined;
if (assistant.configResult.config) {
renderedConfig = await clientRenderHelper(
{
ownerSlug: assistant.ownerSlug,
packageSlug: assistant.packageSlug,
},
YAML.stringify(assistant.configResult.config),
this.ide,
this.controlPlaneClient,

View file

@ -1,5 +1,6 @@
import {
clientRender,
PackageSlug,
PlatformClient,
SecretStore,
} from "@continuedev/config-yaml";
@ -8,6 +9,7 @@ import { IDE } from "../..";
import { ControlPlaneClient } from "../../control-plane/client";
export async function clientRenderHelper(
packageSlug: PackageSlug,
unrolledAssistant: string,
ide: IDE,
controlPlaneClient: ControlPlaneClient,
@ -33,6 +35,7 @@ export async function clientRenderHelper(
const userId = await controlPlaneClient.userId;
return await clientRender(
packageSlug,
unrolledAssistant,
ideSecretStore,
userId ? platformClient : undefined,

View file

@ -4,10 +4,10 @@ import {
AssistantUnrolled,
ConfigResult,
ConfigValidationError,
ModelRole,
parseAssistantUnrolled,
validateConfigYaml,
} from "@continuedev/config-yaml";
import { ModelRole } from "@continuedev/config-yaml";
import { fetchwithRequestOptions } from "@continuedev/fetch";
import {
@ -39,7 +39,6 @@ import { getSystemPromptDotFile } from "../getSystemPromptDotFile";
import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader";
import { modifyContinueConfigWithSharedConfig } from "../sharedConfig";
import { clientRenderHelper } from "./clientRender";
import { llmsFromModelConfig } from "./models";
async function loadConfigYaml(
@ -52,9 +51,11 @@ async function loadConfigYaml(
const ideSettings = await ide.getIdeSettings();
let config =
overrideConfigYaml ??
(ideSettings.continueTestEnvironment === "production"
? await clientRenderHelper(rawYaml, ide, controlPlaneClient)
: parseAssistantUnrolled(rawYaml));
// (ideSettings.continueTestEnvironment === "production"
// ? await clientRenderHelper(rawYaml, ide, controlPlaneClient)
// :
parseAssistantUnrolled(rawYaml);
// );
const errors = validateConfigYaml(config);
if (errors?.some((error) => error.fatal)) {

View file

@ -35,16 +35,6 @@ async function modelConfigToBaseLLM(
return undefined;
}
const usingContinueProxy =
platformConfigMetadata && model.provider === "continue-proxy";
const modelName = usingContinueProxy
? getContinueProxyModelName(
platformConfigMetadata!.ownerSlug,
platformConfigMetadata!.packageSlug,
model,
)
: model.model;
let options: LLMOptions = {
...model,
completionOptions: {
@ -57,7 +47,6 @@ async function modelConfigToBaseLLM(
writeLog,
uniqueId,
title: model.name,
model: modelName,
systemMessage,
promptTemplates: model.promptTemplates,
};

View file

@ -1,5 +1,7 @@
import fetch from "node-fetch";
import * as fs from "node:fs";
import { IdeSettings } from "..";
import { getStagingEnvironmentDotFilePath } from "../util/paths";
export interface ControlPlaneEnv {
DEFAULT_CONTROL_PLANE_PROXY_URL: string;
@ -36,13 +38,11 @@ const PRODUCTION_HUB_ENV: ControlPlaneEnv = {
};
const STAGING_ENV: ControlPlaneEnv = {
DEFAULT_CONTROL_PLANE_PROXY_URL:
"https://control-plane-api-service-537175798139.us-central1.run.app/",
CONTROL_PLANE_URL:
"https://control-plane-api-service-537175798139.us-central1.run.app/",
AUTH_TYPE: WORKOS_CLIENT_ID_STAGING,
DEFAULT_CONTROL_PLANE_PROXY_URL: "https://api.continue-stage.tools/",
CONTROL_PLANE_URL: "https://api.continue-stage.tools/",
AUTH_TYPE: WORKOS_ENV_ID_STAGING,
WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING,
APP_URL: "https://app-preview.continue.dev/",
APP_URL: "https://hub.continue-stage.tools/",
};
const TEST_ENV: ControlPlaneEnv = {
@ -82,11 +82,15 @@ export async function getControlPlaneEnv(
export function getControlPlaneEnvSync(
ideTestEnvironment: IdeSettings["continueTestEnvironment"],
): ControlPlaneEnv {
if (fs.existsSync(getStagingEnvironmentDotFilePath())) {
return STAGING_ENV;
}
const env =
ideTestEnvironment === "production"
? "hub"
: ideTestEnvironment === "test"
? "test"
: ideTestEnvironment === "staging"
? "staging"
: ideTestEnvironment === "local"
? "local"
: process.env.CONTROL_PLANE_ENV;

48
core/index.d.ts vendored
View file

@ -1,6 +1,6 @@
import { ModelRole } from "@continuedev/config-yaml";
import Parser from "web-tree-sitter";
import { GetGhTokenArgs } from "./protocol/ide";
import { ModelRole } from "@continuedev/config-yaml";
declare global {
interface Window {
ide?: "vscode";
@ -43,13 +43,13 @@ export interface IndexingProgressUpdate {
desc: string;
shouldClearIndexes?: boolean;
status:
| "loading"
| "indexing"
| "done"
| "failed"
| "paused"
| "disabled"
| "cancelled";
| "loading"
| "indexing"
| "done"
| "failed"
| "paused"
| "disabled"
| "cancelled";
debugInfo?: string;
}
@ -600,7 +600,7 @@ export interface IdeSettings {
remoteConfigSyncPeriod: number;
userToken: string;
enableControlServerBeta: boolean;
continueTestEnvironment: "none" | "production" | "test" | "local";
continueTestEnvironment: "none" | "production" | "staging" | "local";
pauseCodebaseIndexOnStart: boolean;
}
@ -667,10 +667,10 @@ export interface IDE {
getCurrentFile(): Promise<
| undefined
| {
isUntitled: boolean;
path: string;
contents: string;
}
isUntitled: boolean;
path: string;
contents: string;
}
>;
getPinnedFiles(): Promise<string[]>;
@ -849,11 +849,11 @@ export interface CustomCommand {
export interface Prediction {
type: "content";
content:
| string
| {
type: "text";
text: string;
}[];
| string
| {
type: "text";
text: string;
}[];
}
export interface ToolExtras {
@ -1181,9 +1181,9 @@ export interface Config {
embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
/** The model that Continue will use for tab autocompletions. */
tabAutocompleteModel?:
| CustomLLM
| ModelDescription
| (CustomLLM | ModelDescription)[];
| CustomLLM
| ModelDescription
| (CustomLLM | ModelDescription)[];
/** Options for tab autocomplete */
tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
/** UI styles customization */
@ -1274,9 +1274,9 @@ export type PackageDetailsSuccess = PackageDetails & {
export type PackageDocsResult = {
packageInfo: ParsedPackageInfo;
} & (
| { error: string; details?: never }
| { details: PackageDetailsSuccess; error?: never }
);
| { error: string; details?: never }
| { details: PackageDetailsSuccess; error?: never }
);
export interface TerminalOptions {
reuseTerminal?: boolean;

View file

@ -13,7 +13,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.29",
"@continuedev/config-yaml": "^1.0.31",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -3038,9 +3038,9 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.29",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.29.tgz",
"integrity": "sha512-5zKebdoNp52eSFCrs/EODF36I0basrDdE9gQ6Vxoxd9axzVTyWlbpm6gLXXeaHpJMSCaTcQMh/uzAiq8trwrYA==",
"version": "1.0.31",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.31.tgz",
"integrity": "sha512-HNj+z7UTTARgsJTI0A1buM09fS4HoWVnn6Hbl6kJ2tZmOOm1OgogbcKP68AzHb4fy5H18MWnKS7XuseZpHFzHQ==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",

View file

@ -46,7 +46,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.29",
"@continuedev/config-yaml": "^1.0.31",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

View file

@ -377,6 +377,10 @@ export function getEsbuildBinaryPath(): string {
return path.join(getContinueUtilsPath(), "esbuild");
}
export function getStagingEnvironmentDotFilePath(): string {
return path.join(getContinueGlobalPath(), ".staging");
}
export function setupInitialDotContinueDirectory() {
const devDataTypes = [
"chat",

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.265",
"version": "0.9.266",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.265",
"version": "0.9.266",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",
@ -106,7 +106,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.29",
"@continuedev/config-yaml": "^1.0.31",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "0.9.265",
"version": "0.9.266",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

View file

@ -1061,7 +1061,7 @@ export function registerAllCommands(
core: Core,
editDecorationManager: EditDecorationManager,
) {
registerCopyBufferSpy(context, core);
// registerCopyBufferSpy(context, core);
for (const [command, callback] of Object.entries(
getCommandsMap(

10
gui/package-lock.json generated
View file

@ -7,7 +7,7 @@
"name": "gui",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-yaml": "^1.0.29",
"@continuedev/config-yaml": "^1.0.31",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",
@ -108,7 +108,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.29",
"@continuedev/config-yaml": "^1.0.31",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -556,9 +556,9 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.29",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.29.tgz",
"integrity": "sha512-5zKebdoNp52eSFCrs/EODF36I0basrDdE9gQ6Vxoxd9axzVTyWlbpm6gLXXeaHpJMSCaTcQMh/uzAiq8trwrYA==",
"version": "1.0.31",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.31.tgz",
"integrity": "sha512-HNj+z7UTTARgsJTI0A1buM09fS4HoWVnn6Hbl6kJ2tZmOOm1OgogbcKP68AzHb4fy5H18MWnKS7XuseZpHFzHQ==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",

View file

@ -15,7 +15,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@continuedev/config-yaml": "^1.0.29",
"@continuedev/config-yaml": "^1.0.31",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",

View file

@ -1,6 +1,6 @@
{
"name": "@continuedev/config-yaml",
"version": "1.0.29",
"version": "1.0.31",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -4,7 +4,12 @@ import {
encodeSecretLocation,
SecretLocation,
} from "../interfaces/SecretResult.js";
import { decodeFQSN, encodeFQSN, FQSN } from "../interfaces/slugs.js";
import {
decodeFQSN,
encodeFQSN,
FQSN,
PackageSlug,
} from "../interfaces/slugs.js";
import { AssistantUnrolled } from "../schemas/index.js";
import {
fillTemplateVariables,
@ -13,6 +18,7 @@ import {
} from "./unroll.js";
export async function clientRender(
packageSlug: PackageSlug,
unrolledConfigContent: string,
clientSecretStore: SecretStore,
platformClient?: PlatformClient,
@ -61,7 +67,7 @@ export async function clientRender(
const parsedYaml = parseAssistantUnrolled(renderedYaml);
// 7. We update any of the items with the proxy version if there are un-rendered secrets
const finalConfig = useProxyForUnrenderedSecrets(parsedYaml);
const finalConfig = useProxyForUnrenderedSecrets(parsedYaml, packageSlug);
return finalConfig;
}
@ -89,8 +95,17 @@ function getUnrenderedSecretLocation(
return undefined;
}
function getContinueProxyModelName(
packageSlug: PackageSlug,
provider: string,
model: string,
): string {
return `${packageSlug.ownerSlug}/${packageSlug.packageSlug}/${provider}/${model}`;
}
function useProxyForUnrenderedSecrets(
config: AssistantUnrolled,
packageSlug: PackageSlug,
): AssistantUnrolled {
if (config.models) {
for (let i = 0; i < config.models.length; i++) {
@ -101,6 +116,11 @@ function useProxyForUnrenderedSecrets(
config.models[i] = {
...config.models[i],
provider: "continue-proxy",
model: getContinueProxyModelName(
packageSlug,
config.models[i].provider,
config.models[i].model,
),
apiKeyLocation: encodeSecretLocation(apiKeyLocation),
apiKey: undefined,
};

View file

@ -120,6 +120,7 @@ describe("E2E Scenarios", () => {
);
const clientRendered = await clientRender(
{ ownerSlug: "test-org", packageSlug: "assistant" },
YAML.stringify(unrolledConfig),
localUserSecretStore,
platformClient,