first attempt at loading local blocks
This commit is contained in:
parent
a807a6b56c
commit
8f707a896b
5 changed files with 44 additions and 14 deletions
|
|
@ -2,9 +2,11 @@ import fs from "node:fs";
|
|||
|
||||
import {
|
||||
AssistantUnrolled,
|
||||
BLOCK_TYPES,
|
||||
ConfigResult,
|
||||
ConfigValidationError,
|
||||
ModelRole,
|
||||
parseAssistantUnrolled,
|
||||
RegistryClient,
|
||||
unrollAssistantFromContent,
|
||||
validateConfigYaml,
|
||||
|
|
@ -40,6 +42,7 @@ import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader";
|
|||
import { modifyAnyConfigWithSharedConfig } from "../sharedConfig";
|
||||
|
||||
import { getControlPlaneEnvSync } from "../../control-plane/env";
|
||||
import { getAllDotContinueYamlFiles } from "../loadLocalAssistants";
|
||||
import { LocalPlatformClient } from "./LocalPlatformClient";
|
||||
import { llmsFromModelConfig } from "./models";
|
||||
|
||||
|
|
@ -433,6 +436,29 @@ export async function loadContinueConfigFromYaml(
|
|||
};
|
||||
}
|
||||
|
||||
// Add local .continue blocks
|
||||
for (const blockType of BLOCK_TYPES) {
|
||||
const localBlocks = await getAllDotContinueYamlFiles(
|
||||
ide,
|
||||
{ includeGlobal: true, includeWorkspace: true },
|
||||
blockType,
|
||||
);
|
||||
|
||||
for (const block of localBlocks) {
|
||||
const parsedYaml = parseAssistantUnrolled(block.content);
|
||||
|
||||
const inlineBlock = parsedYaml[blockType]?.[0];
|
||||
if (inlineBlock) {
|
||||
configYamlResult.config[blockType] = [
|
||||
...(configYamlResult.config[blockType] ?? []),
|
||||
inlineBlock as any,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
configYamlResult.config;
|
||||
}
|
||||
|
||||
const { config: continueConfig, errors: localErrors } =
|
||||
await configYamlToContinueConfig(
|
||||
configYamlResult.config,
|
||||
|
|
|
|||
8
core/package-lock.json
generated
8
core/package-lock.json
generated
|
|
@ -13,7 +13,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.777.0",
|
||||
"@aws-sdk/credential-providers": "^3.778.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.80",
|
||||
"@continuedev/config-yaml": "^1.0.81",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.8",
|
||||
"@continuedev/openai-adapters": "^1.0.18",
|
||||
|
|
@ -2977,9 +2977,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
"version": "1.0.80",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.80.tgz",
|
||||
"integrity": "sha512-fHZLh04aThbgK80+B5O0CBBb0IgJbfM0trBWeDI4/MLpxpTJebxX4QY1RZBOdIULKMDMHnfyWNCe2gSGi/mt9Q==",
|
||||
"version": "1.0.81",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.81.tgz",
|
||||
"integrity": "sha512-KNk1n3hXJWL2PSflN9WXlClGVJMJNNSrkn6Fo3BcVu466MOr/vJsuA2In3ZolBMCpg2jNYKYbCC72N1JDFS6ww==",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
"@aws-sdk/client-sagemaker-runtime": "^3.777.0",
|
||||
"@aws-sdk/credential-providers": "^3.778.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "^1.0.80",
|
||||
"@continuedev/config-yaml": "^1.0.81",
|
||||
"@continuedev/fetch": "^1.0.4",
|
||||
"@continuedev/llm-info": "^1.0.8",
|
||||
"@continuedev/openai-adapters": "^1.0.18",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@continuedev/config-yaml",
|
||||
"version": "1.0.80",
|
||||
"version": "1.0.81",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
import { z } from "zod";
|
||||
import { ConfigYaml } from "../schemas/index.js";
|
||||
|
||||
export type BlockType =
|
||||
| "models"
|
||||
| "context"
|
||||
| "docs"
|
||||
| "mcpServers"
|
||||
| "data"
|
||||
| "rules"
|
||||
| "prompts";
|
||||
export const BLOCK_TYPES = [
|
||||
"models",
|
||||
"context",
|
||||
"data",
|
||||
"mcpServers",
|
||||
"rules",
|
||||
"prompts",
|
||||
"docs",
|
||||
] as const;
|
||||
export type BlockType = (typeof BLOCK_TYPES)[number];
|
||||
export const blockTypeSchema = z.enum(BLOCK_TYPES);
|
||||
|
||||
export function getBlockType(block: ConfigYaml): BlockType | undefined {
|
||||
if (block.context?.length) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue