fix: pass agent summaries array instead of client object to createBuiltinAgents (#2386)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -38,7 +38,7 @@ export async function applyAgentConfig(params: {
|
||||
pluginComponents: PluginComponents;
|
||||
}): Promise<Record<string, unknown>> {
|
||||
const migratedDisabledAgents = (params.pluginConfig.disabled_agents ?? []).map(
|
||||
(agent) => {
|
||||
(agent: string) => {
|
||||
return AGENT_NAME_MAP[agent.toLowerCase()] ?? AGENT_NAME_MAP[agent] ?? agent;
|
||||
},
|
||||
) as typeof params.pluginConfig.disabled_agents;
|
||||
@@ -77,6 +77,31 @@ export async function applyAgentConfig(params: {
|
||||
const disabledSkills = new Set<string>(params.pluginConfig.disabled_skills ?? []);
|
||||
const useTaskSystem = params.pluginConfig.experimental?.task_system ?? false;
|
||||
const disableOmoEnv = params.pluginConfig.experimental?.disable_omo_env ?? false;
|
||||
const includeClaudeAgents = params.pluginConfig.claude_code?.agents ?? true;
|
||||
const userAgents = includeClaudeAgents ? loadUserAgents() : {};
|
||||
const projectAgents = includeClaudeAgents ? loadProjectAgents(params.ctx.directory) : {};
|
||||
const rawPluginAgents = params.pluginComponents.agents;
|
||||
const pluginAgents = Object.fromEntries(
|
||||
Object.entries(rawPluginAgents).map(([key, value]) => [
|
||||
key,
|
||||
value ? migrateAgentConfig(value as Record<string, unknown>) : value,
|
||||
]),
|
||||
);
|
||||
const configAgent = params.config.agent as AgentConfigRecord | undefined;
|
||||
const registeredAgentSummaries = Object.entries({
|
||||
...userAgents,
|
||||
...projectAgents,
|
||||
...pluginAgents,
|
||||
...configAgent,
|
||||
})
|
||||
.filter((entry): entry is [string, Record<string, unknown>] => {
|
||||
const registeredAgent = entry[1];
|
||||
return typeof registeredAgent === "object" && registeredAgent !== null;
|
||||
})
|
||||
.map(([name, registeredAgent]) => ({
|
||||
name,
|
||||
...registeredAgent,
|
||||
}));
|
||||
|
||||
const builtinAgents = await createBuiltinAgents(
|
||||
migratedDisabledAgents,
|
||||
@@ -86,7 +111,7 @@ export async function applyAgentConfig(params: {
|
||||
params.pluginConfig.categories,
|
||||
params.pluginConfig.git_master,
|
||||
allDiscoveredSkills,
|
||||
params.ctx.client,
|
||||
registeredAgentSummaries,
|
||||
browserProvider,
|
||||
currentModel,
|
||||
disabledSkills,
|
||||
@@ -94,20 +119,8 @@ export async function applyAgentConfig(params: {
|
||||
disableOmoEnv,
|
||||
);
|
||||
|
||||
const includeClaudeAgents = params.pluginConfig.claude_code?.agents ?? true;
|
||||
const userAgents = includeClaudeAgents ? loadUserAgents() : {};
|
||||
const projectAgents = includeClaudeAgents ? loadProjectAgents(params.ctx.directory) : {};
|
||||
|
||||
const rawPluginAgents = params.pluginComponents.agents;
|
||||
const pluginAgents = Object.fromEntries(
|
||||
Object.entries(rawPluginAgents).map(([key, value]) => [
|
||||
key,
|
||||
value ? migrateAgentConfig(value as Record<string, unknown>) : value,
|
||||
]),
|
||||
);
|
||||
|
||||
const disabledAgentNames = new Set(
|
||||
(migratedDisabledAgents ?? []).map(a => a.toLowerCase())
|
||||
(migratedDisabledAgents ?? []).map((agentName: string) => agentName.toLowerCase())
|
||||
);
|
||||
|
||||
const filterDisabledAgents = (agents: Record<string, unknown>) =>
|
||||
@@ -123,8 +136,6 @@ export async function applyAgentConfig(params: {
|
||||
const shouldDemotePlan = plannerEnabled && replacePlan;
|
||||
const configuredDefaultAgent = getConfiguredDefaultAgent(params.config);
|
||||
|
||||
const configAgent = params.config.agent as AgentConfigRecord | undefined;
|
||||
|
||||
if (isSisyphusEnabled && builtinAgents.sisyphus) {
|
||||
if (configuredDefaultAgent) {
|
||||
(params.config as { default_agent?: string }).default_agent =
|
||||
|
||||
Reference in New Issue
Block a user