( input: string, agents: AgentDefinition[], )
| 1964 | } |
| 1965 | |
| 1966 | function processAgentMentions( |
| 1967 | input: string, |
| 1968 | agents: AgentDefinition[], |
| 1969 | ): Attachment[] { |
| 1970 | const agentMentions = extractAgentMentions(input) |
| 1971 | if (agentMentions.length === 0) return [] |
| 1972 | |
| 1973 | const results = agentMentions.map(mention => { |
| 1974 | const agentType = mention.replace('agent-', '') |
| 1975 | const agentDef = agents.find(def => def.agentType === agentType) |
| 1976 | |
| 1977 | if (!agentDef) { |
| 1978 | logEvent('tengu_at_mention_agent_not_found', {}) |
| 1979 | return null |
| 1980 | } |
| 1981 | |
| 1982 | logEvent('tengu_at_mention_agent_success', {}) |
| 1983 | |
| 1984 | return { |
| 1985 | type: 'agent_mention' as const, |
| 1986 | agentType: agentDef.agentType, |
| 1987 | } |
| 1988 | }) |
| 1989 | |
| 1990 | return results.filter( |
| 1991 | (result): result is NonNullable<typeof result> => result !== null, |
| 1992 | ) |
| 1993 | } |
| 1994 | |
| 1995 | async function processMcpResourceAttachments( |
| 1996 | input: string, |
no test coverage detected