Skip to content

Commit 2a717dd

Browse files
committed
Merge branch 'main' of https://github.com/continuedev/continue into uinstinct/non-whitespace
2 parents 81c23ec + f14a2ff commit 2a717dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+5102
-2682
lines changed

.github/workflows/compliance.yaml

Lines changed: 0 additions & 202 deletions
This file was deleted.

.github/workflows/continue-general-review.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

core/config/yaml/loadYaml.ts

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
22
AssistantUnrolled,
3+
AssistantUnrolledNonNullable,
34
BLOCK_TYPES,
45
ConfigResult,
56
ConfigValidationError,
6-
isAssistantUnrolledNonNullable,
77
mergeConfigYamlRequestOptions,
88
mergeUnrolledAssistants,
99
ModelRole,
@@ -145,8 +145,8 @@ async function loadConfigYaml(options: {
145145
}
146146
}
147147

148-
if (config && isAssistantUnrolledNonNullable(config)) {
149-
errors.push(...validateConfigYaml(config));
148+
if (config) {
149+
errors.push(...validateConfigYaml(nonNullifyConfigYaml(config)));
150150
}
151151

152152
if (errors?.some((error) => error.fatal)) {
@@ -165,15 +165,30 @@ async function loadConfigYaml(options: {
165165
};
166166
}
167167

168+
function nonNullifyConfigYaml(
169+
unrolledAssistant: AssistantUnrolled,
170+
): AssistantUnrolledNonNullable {
171+
return {
172+
...unrolledAssistant,
173+
data: unrolledAssistant.data?.filter((k) => !!k),
174+
context: unrolledAssistant.context?.filter((k) => !!k),
175+
docs: unrolledAssistant.docs?.filter((k) => !!k),
176+
mcpServers: unrolledAssistant.mcpServers?.filter((k) => !!k),
177+
models: unrolledAssistant.models?.filter((k) => !!k),
178+
prompts: unrolledAssistant.prompts?.filter((k) => !!k),
179+
rules: unrolledAssistant.rules?.filter((k) => !!k).map((k) => k!),
180+
};
181+
}
182+
168183
export async function configYamlToContinueConfig(options: {
169-
config: AssistantUnrolled;
184+
unrolledAssistant: AssistantUnrolled;
170185
ide: IDE;
171186
ideInfo: IdeInfo;
172187
uniqueId: string;
173188
llmLogger: ILLMLogger;
174189
workOsAccessToken: string | undefined;
175190
}): Promise<{ config: ContinueConfig; errors: ConfigValidationError[] }> {
176-
let { config, ide, ideInfo, uniqueId, llmLogger } = options;
191+
let { unrolledAssistant, ide, ideInfo, uniqueId, llmLogger } = options;
177192

178193
const localErrors: ConfigValidationError[] = [];
179194

@@ -203,22 +218,10 @@ export async function configYamlToContinueConfig(options: {
203218
subagent: null,
204219
},
205220
rules: [],
206-
requestOptions: { ...config.requestOptions },
221+
requestOptions: { ...unrolledAssistant.requestOptions },
207222
};
208223

209-
// Right now, if there are any missing packages in the config, then we will just throw an error
210-
if (!isAssistantUnrolledNonNullable(config)) {
211-
return {
212-
config: continueConfig,
213-
errors: [
214-
{
215-
message:
216-
"Failed to load config due to missing blocks, see which blocks are missing below",
217-
fatal: true,
218-
},
219-
],
220-
};
221-
}
224+
const config = nonNullifyConfigYaml(unrolledAssistant);
222225

223226
for (const rule of config.rules ?? []) {
224227
const convertedRule = convertYamlRuleToContinueRule(rule);
@@ -255,9 +258,30 @@ export async function configYamlToContinueConfig(options: {
255258
continueConfig.slashCommands?.push(slashCommand);
256259
}
257260
} catch (e) {
261+
// If the file is in a rules directory, we can provide a more helpful error message
262+
// because we know it's likely a rule definition
263+
const isRuleFile =
264+
file.path.toLowerCase().includes("/rules/") ||
265+
file.path.toLowerCase().includes("\\rules\\");
266+
267+
let message = `Failed to convert prompt file ${file.path} to slash command: ${e instanceof Error ? e.message : e}`;
268+
269+
if (isRuleFile) {
270+
const isYamlError =
271+
e instanceof Error &&
272+
(e.name?.includes("YAML") || e.message.includes("flow sequence"));
273+
274+
const prefix = isYamlError
275+
? "Failed to parse rule definition"
276+
: "Failed to process rule definition";
277+
278+
const errorDetails = e instanceof Error ? e.message : String(e);
279+
message = `${prefix} ${file.path}: ${errorDetails}`;
280+
}
281+
258282
localErrors.push({
259283
fatal: false,
260-
message: `Failed to convert prompt file ${file.path} to slash command: ${e instanceof Error ? e.message : e}`,
284+
message,
261285
});
262286
}
263287
});
@@ -447,7 +471,7 @@ export async function loadContinueConfigFromYaml(options: {
447471

448472
const { config: continueConfig, errors: localErrors } =
449473
await configYamlToContinueConfig({
450-
config: configYamlResult.config,
474+
unrolledAssistant: configYamlResult.config,
451475
ide,
452476
ideInfo,
453477
uniqueId,

core/config/yaml/models.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ async function modelConfigToBaseLLM({
6767
baseAgentSystemMessage: model.chatOptions?.baseAgentSystemMessage,
6868
basePlanSystemMessage: model.chatOptions?.basePlanSystemMessage,
6969
baseChatSystemMessage: model.chatOptions?.baseSystemMessage,
70+
toolOverrides: model.chatOptions?.toolOverrides
71+
? Object.entries(model.chatOptions.toolOverrides).map(([name, o]) => ({
72+
name,
73+
...o,
74+
}))
75+
: undefined,
7076
capabilities: {
7177
tools: model.capabilities?.includes("tool_use"),
7278
uploadImage: model.capabilities?.includes("image_input"),

0 commit comments

Comments
 (0)