Revert name fields from agent configs, add getAgentConfigKey reverse lookup
Remove crash-causing name fields from 6 agent configs (sisyphus, hephaestus, atlas, metis, momus, prometheus). The name field approach breaks opencode because Agent.get(agent.name) uses name as lookup key. Add getAgentConfigKey() to agent-display-names.ts for resolving display names back to lowercase config keys (e.g. 'Atlas (Plan Executor)' -> 'atlas').
This commit is contained in:
@@ -35,4 +35,20 @@ export function getAgentDisplayName(configKey: string): string {
|
||||
|
||||
// Unknown agent: return original key
|
||||
return configKey
|
||||
}
|
||||
|
||||
const REVERSE_DISPLAY_NAMES: Record<string, string> = Object.fromEntries(
|
||||
Object.entries(AGENT_DISPLAY_NAMES).map(([key, displayName]) => [displayName.toLowerCase(), key]),
|
||||
)
|
||||
|
||||
/**
|
||||
* Resolve an agent name (display name or config key) to its lowercase config key.
|
||||
* "Atlas (Plan Executor)" → "atlas", "atlas" → "atlas", "unknown" → "unknown"
|
||||
*/
|
||||
export function getAgentConfigKey(agentName: string): string {
|
||||
const lower = agentName.toLowerCase()
|
||||
const reversed = REVERSE_DISPLAY_NAMES[lower]
|
||||
if (reversed !== undefined) return reversed
|
||||
if (AGENT_DISPLAY_NAMES[lower] !== undefined) return lower
|
||||
return lower
|
||||
}
|
||||
Reference in New Issue
Block a user