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