Normalize agent name comparisons to handle display name keys
Hooks and tools now use getAgentConfigKey() to resolve agent names (which may be display names like 'Atlas (Plan Executor)') to lowercase config keys before comparison. - session-utils: orchestrator check uses getAgentConfigKey - atlas event-handler: boulder agent matching uses config keys - category-skill-reminder: target agent check uses config keys - todo-continuation-enforcer: skipAgents comparison normalized - subagent-resolver: resolves 'metis' -> 'Metis (Plan Consultant)' for lookup
This commit is contained in:
@@ -2,6 +2,7 @@ import { findNearestMessageWithFields, findNearestMessageWithFieldsFromSDK } fro
|
||||
import { getMessageDir } from "./opencode-message-dir"
|
||||
import { isSqliteBackend } from "./opencode-storage-detection"
|
||||
import { log } from "./logger"
|
||||
import { getAgentConfigKey } from "./agent-display-names"
|
||||
import type { PluginInput } from "@opencode-ai/plugin"
|
||||
|
||||
export async function isCallerOrchestrator(sessionID?: string, client?: PluginInput["client"]): Promise<boolean> {
|
||||
@@ -10,7 +11,7 @@ export async function isCallerOrchestrator(sessionID?: string, client?: PluginIn
|
||||
if (isSqliteBackend() && client) {
|
||||
try {
|
||||
const nearest = await findNearestMessageWithFieldsFromSDK(client, sessionID)
|
||||
return nearest?.agent?.toLowerCase() === "atlas"
|
||||
return getAgentConfigKey(nearest?.agent ?? "") === "atlas"
|
||||
} catch (error) {
|
||||
log("[session-utils] SDK orchestrator check failed", { sessionID, error: String(error) })
|
||||
return false
|
||||
@@ -20,5 +21,5 @@ export async function isCallerOrchestrator(sessionID?: string, client?: PluginIn
|
||||
const messageDir = getMessageDir(sessionID)
|
||||
if (!messageDir) return false
|
||||
const nearest = findNearestMessageWithFields(messageDir)
|
||||
return nearest?.agent?.toLowerCase() === "atlas"
|
||||
return getAgentConfigKey(nearest?.agent ?? "") === "atlas"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user