upgrade config-yaml package and update types to match
This commit is contained in:
parent
4c554f05f4
commit
938aaeb35f
12 changed files with 42 additions and 37 deletions
|
|
@ -16,7 +16,11 @@ import Ollama from "../llm/llms/Ollama.js";
|
|||
import { GlobalContext } from "../util/GlobalContext.js";
|
||||
import { getConfigJsonPath, getConfigYamlPath } from "../util/paths.js";
|
||||
|
||||
import { ConfigResult, ConfigYaml, FullSlug } from "@continuedev/config-yaml";
|
||||
import {
|
||||
AssistantUnrolled,
|
||||
ConfigResult,
|
||||
FullSlug,
|
||||
} from "@continuedev/config-yaml";
|
||||
import * as YAML from "yaml";
|
||||
import { getControlPlaneEnv, useHub } from "../control-plane/env.js";
|
||||
import { localPathToUri } from "../util/pathToUri.js";
|
||||
|
|
@ -118,7 +122,7 @@ export class ConfigHandler {
|
|||
.then(async (assistants) => {
|
||||
const hubProfiles = await Promise.all(
|
||||
assistants.map(async (assistant) => {
|
||||
let renderedConfig: ConfigYaml | undefined = undefined;
|
||||
let renderedConfig: AssistantUnrolled | undefined = undefined;
|
||||
if (assistant.configResult.config) {
|
||||
renderedConfig = await clientRenderHelper(
|
||||
YAML.stringify(assistant.configResult.config),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js";
|
||||
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas/index.js";
|
||||
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { ContinueConfig, IDE, IdeSettings } from "../../index.js";
|
||||
|
|
@ -24,7 +24,7 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
description: ProfileDescription;
|
||||
|
||||
constructor(
|
||||
private configResult: ConfigResult<ConfigYaml>,
|
||||
private configResult: ConfigResult<AssistantUnrolled>,
|
||||
private readonly ownerSlug: string,
|
||||
private readonly packageSlug: string,
|
||||
versionSlug: string,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import fs from "fs";
|
||||
|
||||
import {
|
||||
AssistantUnrolled,
|
||||
ConfigResult,
|
||||
ConfigValidationError,
|
||||
ConfigYaml,
|
||||
} from "@continuedev/config-yaml";
|
||||
import {
|
||||
ContinueConfig,
|
||||
|
|
@ -30,7 +30,7 @@ export default async function doLoadConfig(
|
|||
controlPlaneClient: ControlPlaneClient,
|
||||
writeLog: (message: string) => Promise<void>,
|
||||
overrideConfigJson: SerializedContinueConfig | undefined,
|
||||
overrideConfigYaml: ConfigYaml | undefined,
|
||||
overrideConfigYaml: AssistantUnrolled | undefined,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
workspaceId?: string,
|
||||
): Promise<ConfigResult<ContinueConfig>> {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { ModelConfig } from "@continuedev/config-yaml";
|
||||
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas";
|
||||
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas";
|
||||
|
||||
import { SerializedContinueConfig } from "../..";
|
||||
|
||||
export function convertConfigJsonToConfigYaml(
|
||||
configJson: SerializedContinueConfig,
|
||||
): ConfigYaml {
|
||||
): AssistantUnrolled {
|
||||
return {
|
||||
name: "Local Config",
|
||||
version: "1.0.0",
|
||||
|
|
@ -24,8 +24,8 @@ export function convertConfigJsonToConfigYaml(
|
|||
// rerankModels
|
||||
],
|
||||
context: configJson.contextProviders?.map((provider) => ({
|
||||
uses: provider.name,
|
||||
with: provider.params,
|
||||
provider: provider.name,
|
||||
params: provider.params,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas";
|
||||
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas";
|
||||
|
||||
// TODO
|
||||
export const defaultConfigYaml: ConfigYaml = {
|
||||
export const defaultConfigYaml: AssistantUnrolled = {
|
||||
models: [],
|
||||
context: [],
|
||||
name: "Local Config",
|
||||
version: "1.0.0",
|
||||
};
|
||||
|
||||
export const defaultConfigYamlJetBrains: ConfigYaml = {
|
||||
export const defaultConfigYamlJetBrains: AssistantUnrolled = {
|
||||
models: [],
|
||||
context: [],
|
||||
name: "Local Config",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import fs from "node:fs";
|
||||
|
||||
import {
|
||||
AssistantUnrolled,
|
||||
ConfigResult,
|
||||
ConfigYaml,
|
||||
validateConfigYaml,
|
||||
} from "@continuedev/config-yaml";
|
||||
import { fetchwithRequestOptions } from "@continuedev/fetch";
|
||||
|
|
@ -40,10 +40,10 @@ import { llmsFromModelConfig } from "./models";
|
|||
async function loadConfigYaml(
|
||||
workspaceConfigs: string[],
|
||||
rawYaml: string,
|
||||
overrideConfigYaml: ConfigYaml | undefined,
|
||||
overrideConfigYaml: AssistantUnrolled | undefined,
|
||||
ide: IDE,
|
||||
controlPlaneClient: ControlPlaneClient,
|
||||
): Promise<ConfigResult<ConfigYaml>> {
|
||||
): Promise<ConfigResult<AssistantUnrolled>> {
|
||||
let config =
|
||||
overrideConfigYaml ??
|
||||
(await clientRenderHelper(rawYaml, ide, controlPlaneClient));
|
||||
|
|
@ -86,7 +86,7 @@ async function slashCommandsFromV1PromptFiles(
|
|||
}
|
||||
|
||||
async function configYamlToContinueConfig(
|
||||
config: ConfigYaml,
|
||||
config: AssistantUnrolled,
|
||||
ide: IDE,
|
||||
ideSettings: IdeSettings,
|
||||
uniqueId: string,
|
||||
|
|
@ -181,7 +181,8 @@ async function configYamlToContinueConfig(
|
|||
|
||||
// Context providers
|
||||
const codebaseContextParams: IContextProvider[] =
|
||||
(config.context || []).find((cp) => cp.uses === "codebase")?.with || {};
|
||||
(config.context || []).find((cp) => cp.provider === "codebase")?.params ||
|
||||
{};
|
||||
const DEFAULT_CONTEXT_PROVIDERS = [
|
||||
new FileContextProvider({}),
|
||||
new CodebaseContextProvider(codebaseContextParams),
|
||||
|
|
@ -194,14 +195,14 @@ async function configYamlToContinueConfig(
|
|||
|
||||
continueConfig.contextProviders = (config.context
|
||||
?.map((context) => {
|
||||
const cls = contextProviderClassFromName(context.uses) as any;
|
||||
const cls = contextProviderClassFromName(context.provider) as any;
|
||||
if (!cls) {
|
||||
if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.uses)) {
|
||||
console.warn(`Unknown context provider ${context.uses}`);
|
||||
if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.provider)) {
|
||||
console.warn(`Unknown context provider ${context.provider}`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
const instance: IContextProvider = new cls(context.with ?? {});
|
||||
const instance: IContextProvider = new cls(context.params ?? {});
|
||||
return instance;
|
||||
})
|
||||
.filter((p) => !!p) ?? []) as IContextProvider[];
|
||||
|
|
@ -296,7 +297,7 @@ export async function loadContinueConfigFromYaml(
|
|||
uniqueId: string,
|
||||
writeLog: (log: string) => Promise<void>,
|
||||
workOsAccessToken: string | undefined,
|
||||
overrideConfigYaml: ConfigYaml | undefined,
|
||||
overrideConfigYaml: AssistantUnrolled | undefined,
|
||||
platformConfigMetadata: PlatformConfigMetadata | undefined,
|
||||
controlPlaneClient: ControlPlaneClient,
|
||||
): Promise<ConfigResult<ContinueConfig>> {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { ConfigJson } from "@continuedev/config-types";
|
||||
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js";
|
||||
import fetch, { RequestInit, Response } from "node-fetch";
|
||||
|
||||
import { IdeSettings, ModelDescription } from "../index.js";
|
||||
|
||||
import {
|
||||
AssistantUnrolled,
|
||||
ConfigResult,
|
||||
FQSN,
|
||||
FullSlug,
|
||||
|
|
@ -109,7 +109,7 @@ export class ControlPlaneClient {
|
|||
|
||||
public async listAssistants(): Promise<
|
||||
{
|
||||
configResult: ConfigResult<ConfigYaml>;
|
||||
configResult: ConfigResult<AssistantUnrolled>;
|
||||
ownerSlug: string;
|
||||
packageSlug: string;
|
||||
iconUrl: string;
|
||||
|
|
|
|||
8
core/package-lock.json
generated
8
core/package-lock.json
generated
|
|
@ -13,7 +13,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.16",
|
||||
"@continuedev/config-yaml": "^1.0.17",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
@ -3038,9 +3038,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.16",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.16.tgz",
|
||||
"integrity": "sha512-r3dzTvL8aQ5RrzM+FX6fF+U12/crU4wpPXgDcDloSsxiOQfu3k/shLCbNzFPW57XhLUQAmUJYSZsJbIvYrNPNA==",
|
||||
"version": "1.0.17",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.17.tgz",
|
||||
"integrity": "sha512-T1XwVuLdz0WypBt/0jUM9FKVi3VixrI/IcMzU/ErihFQ9RXMXAlH1kMdyerWb4df8/8/V2vK7G0RS/AoVarmIg==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.16",
|
||||
"@continuedev/config-yaml": "^1.0.17",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
|
|||
10
gui/package-lock.json
generated
10
gui/package-lock.json
generated
|
|
@ -7,7 +7,7 @@
|
|||
"name": "gui",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.15",
|
||||
"@continuedev/config-yaml": "^1.0.17",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
|
||||
"@aws-sdk/credential-providers": "^3.620.1",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.16",
|
||||
"@continuedev/config-yaml": "^1.0.17",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@continuedev/openai-adapters": "^1.0.10",
|
||||
|
|
@ -556,9 +556,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.15.tgz",
|
||||
"integrity": "sha512-00c1pz+FqAVEWLo8t71OJzm1KBAAJCXqIjd917Vy8lr7xO0Eoj42lo2GFlVRnqQ0hQvhFQ0s9onHhRag/phHZA==",
|
||||
"version": "1.0.17",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.17.tgz",
|
||||
"integrity": "sha512-T1XwVuLdz0WypBt/0jUM9FKVi3VixrI/IcMzU/ErihFQ9RXMXAlH1kMdyerWb4df8/8/V2vK7G0RS/AoVarmIg==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"test:watch": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.15",
|
||||
"@continuedev/config-yaml": "^1.0.17",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@continuedev/config-yaml",
|
||||
"version": "1.0.16",
|
||||
"version": "1.0.17",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue