Files
oh-my-opencode/src/features/team-mode/resolve-caller-team-lead.ts
T
YeonGyu-Kim 6a8bdcaa25 feat(team-mode): add resolveCallerTeamLead helper
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-05-04 01:43:55 +09:00

48 lines
1.2 KiB
TypeScript

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
}