feat(config): add custom_agents overrides and strict agent validation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { CategoryConfig } from "../config/schema";
|
||||
import { PROMETHEUS_PERMISSION, getPrometheusPrompt } from "../agents/prometheus";
|
||||
import { resolvePromptAppend } from "../agents/builtin-agents/resolve-file-uri";
|
||||
import { parseRegisteredAgentSummaries } from "../agents/custom-agent-summaries";
|
||||
import { AGENT_MODEL_REQUIREMENTS } from "../shared/model-requirements";
|
||||
import {
|
||||
fetchAvailableModels,
|
||||
@@ -27,6 +28,7 @@ export async function buildPrometheusAgentConfig(params: {
|
||||
pluginPrometheusOverride: PrometheusOverride | undefined;
|
||||
userCategories: Record<string, CategoryConfig> | undefined;
|
||||
currentModel: string | undefined;
|
||||
customAgentSummaries?: unknown;
|
||||
}): Promise<Record<string, unknown>> {
|
||||
const categoryConfig = params.pluginPrometheusOverride?.category
|
||||
? resolveCategoryConfig(params.pluginPrometheusOverride.category, params.userCategories)
|
||||
@@ -65,11 +67,18 @@ export async function buildPrometheusAgentConfig(params: {
|
||||
const maxTokensToUse =
|
||||
params.pluginPrometheusOverride?.maxTokens ?? categoryConfig?.maxTokens;
|
||||
|
||||
const customAgentCatalog = parseRegisteredAgentSummaries(params.customAgentSummaries)
|
||||
const customAgentBlock = customAgentCatalog.length > 0
|
||||
? `\n\n<custom_agent_catalog>\nAvailable custom agents for planning/delegation:\n${customAgentCatalog
|
||||
.map((agent) => `- ${agent.name}: ${agent.description || "No description provided"}`)
|
||||
.join("\n")}\n</custom_agent_catalog>`
|
||||
: ""
|
||||
|
||||
const base: Record<string, unknown> = {
|
||||
...(resolvedModel ? { model: resolvedModel } : {}),
|
||||
...(variantToUse ? { variant: variantToUse } : {}),
|
||||
mode: "all",
|
||||
prompt: getPrometheusPrompt(resolvedModel),
|
||||
prompt: getPrometheusPrompt(resolvedModel) + customAgentBlock,
|
||||
permission: PROMETHEUS_PERMISSION,
|
||||
description: `${(params.configAgentPlan?.description as string) ?? "Plan agent"} (Prometheus - OhMyOpenCode)`,
|
||||
color: (params.configAgentPlan?.color as string) ?? "#FF5722",
|
||||
|
||||
Reference in New Issue
Block a user