- Add 'prometheus' to BuiltinAgentNameSchema enum
- Update delegate_task parameter names in documentation (agent → subagent_type, background → run_in_background)
- Make agent name comparison case-insensitive in Atlas hook
- Implement case-insensitive agent config lookup in shared utilities
- Relax type signature for disabled agents parameter
🤖 Generated with assistance of OhMyOpenCode
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import type { OhMyOpenCodeConfig } from "../config"
|
|
import { findCaseInsensitive } from "./case-insensitive"
|
|
|
|
export function resolveAgentVariant(
|
|
config: OhMyOpenCodeConfig,
|
|
agentName?: string
|
|
): string | undefined {
|
|
if (!agentName) {
|
|
return undefined
|
|
}
|
|
|
|
const agentOverrides = config.agents as
|
|
| Record<string, { variant?: string; category?: string }>
|
|
| undefined
|
|
const agentOverride = agentOverrides ? findCaseInsensitive(agentOverrides, agentName) : undefined
|
|
if (!agentOverride) {
|
|
return undefined
|
|
}
|
|
|
|
if (agentOverride.variant) {
|
|
return agentOverride.variant
|
|
}
|
|
|
|
const categoryName = agentOverride.category
|
|
if (!categoryName) {
|
|
return undefined
|
|
}
|
|
|
|
return config.categories?.[categoryName]?.variant
|
|
}
|
|
|
|
export function applyAgentVariant(
|
|
config: OhMyOpenCodeConfig,
|
|
agentName: string | undefined,
|
|
message: { variant?: string }
|
|
): void {
|
|
const variant = resolveAgentVariant(config, agentName)
|
|
if (variant !== undefined && message.variant === undefined) {
|
|
message.variant = variant
|
|
}
|
|
}
|