mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
refactor: improve agent file model validation and settings source deduplication
- Enhanced model parsing in agent discovery to validate against allowed values and log warnings for invalid models. - Refactored settingSources construction in AgentService to utilize Set for automatic deduplication, simplifying the merging of user and project settings with skills sources. - Updated tests to reflect changes in allowedTools for improved functionality. These changes enhance the robustness of agent configuration and streamline settings management.
This commit is contained in:
@@ -289,25 +289,12 @@ export class AgentService {
|
||||
const maxTurns = sdkOptions.maxTurns;
|
||||
let allowedTools = sdkOptions.allowedTools as string[] | undefined;
|
||||
|
||||
// Build merged settingSources array (filter to only 'user' and 'project')
|
||||
const settingSources: Array<'user' | 'project'> = [];
|
||||
if (sdkOptions.settingSources) {
|
||||
sdkOptions.settingSources.forEach((source) => {
|
||||
if (source === 'user' || source === 'project') {
|
||||
if (!settingSources.includes(source)) {
|
||||
settingSources.push(source);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// Merge skills sources (avoid duplicates)
|
||||
if (skillsConfig.enabled && skillsConfig.sources.length > 0) {
|
||||
skillsConfig.sources.forEach((source) => {
|
||||
if (!settingSources.includes(source)) {
|
||||
settingSources.push(source);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Build merged settingSources array using Set for automatic deduplication
|
||||
const sdkSettingSources = (sdkOptions.settingSources ?? []).filter(
|
||||
(source): source is 'user' | 'project' => source === 'user' || source === 'project'
|
||||
);
|
||||
const skillSettingSources = skillsConfig.enabled ? skillsConfig.sources : [];
|
||||
const settingSources = [...new Set([...sdkSettingSources, ...skillSettingSources])];
|
||||
|
||||
// Enhance allowedTools with Skills and Subagents tools
|
||||
if (allowedTools) {
|
||||
|
||||
Reference in New Issue
Block a user