( input: string, agents: AgentDefinition[], )
| 2016 | } |
| 2017 | |
| 2018 | function processAgentMentions( |
| 2019 | input: string, |
| 2020 | agents: AgentDefinition[], |
| 2021 | ): Attachment[] { |
| 2022 | const agentMentions = extractAgentMentions(input) |
| 2023 | if (agentMentions.length === 0) return [] |
| 2024 | |
| 2025 | const results = agentMentions.map(mention => { |
| 2026 | const agentType = mention.replace('agent-', '') |
| 2027 | const agentDef = agents.find(def => def.agentType === agentType) |
| 2028 | |
| 2029 | if (!agentDef) { |
| 2030 | logEvent('tengu_at_mention_agent_not_found', {}) |
| 2031 | return null |
| 2032 | } |
| 2033 | |
| 2034 | logEvent('tengu_at_mention_agent_success', {}) |
| 2035 | |
| 2036 | return { |
| 2037 | type: 'agent_mention' as const, |
| 2038 | agentType: agentDef.agentType, |
| 2039 | } |
| 2040 | }) |
| 2041 | |
| 2042 | return results.filter( |
| 2043 | (result): result is NonNullable<typeof result> => result !== null, |
| 2044 | ) |
| 2045 | } |
| 2046 | |
| 2047 | async function processMcpResourceAttachments( |
| 2048 | input: string, |
no test coverage detected