feat(team-mode): add resolveCallerTeamLead helper

🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2026-05-04 01:43:55 +09:00
parent 9ba3b574a7
commit 6a8bdcaa25
@@ -0,0 +1,47 @@
import { getAgentConfigKey, stripAgentListSortPrefix } from "../../shared/agent-display-names"
import { AGENT_ELIGIBILITY_REGISTRY, type TeamSpec } from "./types"
export type CallerTeamLead = {
agentTypeId?: string
displayName?: string
isEligibleForTeamLead: boolean
}
export function resolveCallerTeamLead(rawAgentName: string | undefined): CallerTeamLead {
if (typeof rawAgentName !== "string") {
return { isEligibleForTeamLead: false }
}
const displayName = stripAgentListSortPrefix(rawAgentName).trim()
if (!displayName) {
return { isEligibleForTeamLead: false }
}
const agentTypeId = getAgentConfigKey(displayName)
const eligibility = AGENT_ELIGIBILITY_REGISTRY[agentTypeId]
if (!eligibility || eligibility.verdict === "hard-reject") {
return {
displayName,
isEligibleForTeamLead: false,
}
}
return {
agentTypeId,
displayName,
isEligibleForTeamLead: true,
}
}
export function shouldReuseCallerLeadSession(spec: TeamSpec, callerAgentTypeId: string | undefined): boolean {
if (callerAgentTypeId === undefined) {
return false
}
if (spec.leadAgentId === undefined) {
return false
}
return true
}