Remap config.agent keys to display names at output boundary
Use display names as config.agent keys so opencode shows proper names in UI (Tab/@ menu). Key remapping happens after all agents are assembled but before reordering, via remapAgentKeysToDisplayNames(). - agent-config-handler: set default_agent to display name, add key remapping - agent-key-remapper: new module to transform lowercase keys to display names - agent-priority-order: CORE_AGENT_ORDER uses display names - tool-config-handler: look up agents by config key via agentByKey() helper
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { AGENT_DISPLAY_NAMES } from "../shared/agent-display-names"
|
||||
|
||||
export function remapAgentKeysToDisplayNames(
|
||||
agents: Record<string, unknown>,
|
||||
): Record<string, unknown> {
|
||||
const result: Record<string, unknown> = {}
|
||||
|
||||
for (const [key, value] of Object.entries(agents)) {
|
||||
const displayName = AGENT_DISPLAY_NAMES[key]
|
||||
if (displayName && displayName !== key) {
|
||||
result[displayName] = value
|
||||
} else {
|
||||
result[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user